﻿using System;
using System.Collections.Generic;
using System.Windows;
using System.Windows.Documents;
using System.Data.OleDb;
using System.Data;
using System.Collections;
using DataMining.Bean;
using DataMining.DataAccess;
using DopWebService.intelray.webservice;
using DopWebService;
using System.Text.RegularExpressions;

namespace DataMining.Control.Transport
{
    /// <summary>
    /// 具体的表的数据存入
    /// </summary>
    public class TransporByTable
    {
        public ProBar bar;

        /// <summary>
        /// 从GetDB的DataTable将患者信息表存入数据库
        /// </summary>
        /// <param name=""></param>
        public void Patient_Information_TransByDB()
        {
            PatientInformationAccess access = new PatientInformationAccess();
            List<Patient_Information> list = new List<Patient_Information>();

            GetDB getdb = new GetDB();                              //调用GetDB类
            DataTable dta = new DataTable();                          //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Patient_Information"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);       //结束时间

            bar = new ProBar();
           // bar = new ProBar(create_time);
            int point_time_num;      //开始时间点的数据数
            int step_time_num;           //要取时间段的数据数

            //bar.Show();                  //初始化进度条
        

            for (int j = 0; j < 6;j++)   //取3天的数据
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);  
                }

                dta = getdb.getPatient_information_DataTable(create_time,access);
                point_time_num = Num.GetCount2("Patient_Information", create_time);
                step_time_num = dta.Rows.Count;


                //若这个时间段无数据
                while (point_time_num == step_time_num || dta.Rows.Count == 0)
                {
                    //MessageBox.Show("从" + create_time.ToString() + "到" + end_time.ToString() + "，没有数据");
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getPatient_information_DataTable(create_time,access);
                    step_time_num = dta.Rows.Count;
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    #region 表属性填充
                    Patient_Information patient = new Patient_Information();

                    #region 医疗机构代码
                    patient.YLJGDM = dta.Rows[i]["c_str_037"].ToString();
                    #endregion

                    #region 病人ID
                    patient.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_011"]);
                    #endregion

                    #region 卡号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_021"]))
                    {
                        patient.KH = "不明";
                    }
                    else
                    {
                        patient.KH = dta.Rows[i]["c_str_021"].ToString();
                    }
                    #endregion

                    #region 卡类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        patient.KLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "0")
                    {
                        patient.KLX = "社保卡";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "1")
                    {
                        patient.KLX = "医保卡";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "2")
                    {
                        patient.KLX = "医联卡";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "3")
                    {
                        patient.KLX = "医院就医卡";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "9")
                    {
                        patient.KLX = "其他";
                    }
                    #endregion

                    #region 证件号码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        patient.ZJHM = "不明";
                    }
                    else
                    {
                        patient.ZJHM = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 性别
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_005"]))
                    {
                        patient.XB = "不明";
                    }
                    else if (dta.Rows[i]["c_int_005"].ToString() == "0")
                    {
                        patient.XB = "未知的性别";
                    }
                    else if (dta.Rows[i]["c_int_005"].ToString() == "1")
                    {
                        patient.XB = "男";
                    }
                    else if (dta.Rows[i]["c_int_005"].ToString() == "2" || dta.Rows[i]["c_int_005"].ToString() == "")
                    {
                        patient.XB = "女";
                    }
                    else if (dta.Rows[i]["c_int_005"].ToString() == "9")
                    {
                        patient.XB = "未说明的性别";
                    }
                    #endregion

                    #region 年龄
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        patient.NL = 000;//age
                    }
                    else 
                    {
                        Regex r = new Regex(@"\d{4}");
                        Match m = r.Match(dta.Rows[i]["c_date_000"].ToString());
                        if(m.Success)
                        {
                            int birthyear = Convert.ToInt32(m.ToString());
                            int nowyear = Convert.ToInt32(DateTime.Now.Year);
                            int age = nowyear - birthyear;
                            patient.NL = age;
                        }
                    }
                    #endregion

                    #region 姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_015"]))
                    {
                        patient.XM = "不明";
                    }
                    else
                    {
                        patient.XM = dta.Rows[i]["c_str_015"].ToString();
                    }
                    #endregion

                    #region 居住地址
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_026"]))
                    {
                        patient.JZDZ = "不明";
                    }
                    else
                    {
                        patient.JZDZ = dta.Rows[i]["c_str_026"].ToString();
                    }
                    #endregion

                    #region 出生日期
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        patient.CSRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        patient.CSRQ = Convert.ToDateTime(dta.Rows[i]["c_date_000"].ToString());//birth_date
                    }
                    #endregion

                    #region 创建时间
                    patient.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    #endregion

                    #region 其他
                    patient.XGBZ = 0;
                    patient.YLYL1 = null;
                    patient.YLYL2 = null;
                    #endregion

                    list.Add(patient);
                    #endregion
                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                }
                access.InsertList(list,bar);
                list.Clear();
                dta.Clear();

               // bar.ProbarAdd();
          
              
                MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
       }

        /// <summary>
        /// 从GetDB的DataTable将门诊记录表存入数据库
        /// </summary>
        /// <param name=""></param>
        public void OutPatient_Record_TransByDB()
        {
            Outpatient_RecordAccess access = new Outpatient_RecordAccess();
            List<Outpatient_Record> list = new List<Outpatient_Record>();
            //Outpatient_Record outpatient_record = new Outpatient_Record();

            GetDB getdb = new GetDB();                                //调用GetDB类
            DataTable dta = new DataTable();                          //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-21 15:59:00");

            DateTime create_time;
            GetNum Num = new GetNum();
  

            //取出当前已经存入的最大创建时间
            create_time = Num.GetMaxNumber("CJSJ", "Outpatient_Record");//开始时间
            DateTime end_time = access.Add_Create_Time(create_time);    //结束时间

            bar = new ProBar();
            //bar = new ProBar(create_time);
            int point_time_num;      //开始时间点的数据数
            int step_time_num;           //要取时间段的数据数

            //bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)     //取3天的数据
            {
                #region
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                //获取数据源的表
                dta = getdb.getOutpatient_Record_DataTable(create_time,access);
                point_time_num = Num.GetCount2("Outpatient_Record", create_time);
                step_time_num = dta.Rows.Count;

                //若这个时间段无数据
                while (point_time_num == step_time_num || dta.Rows.Count == 0)
                {
                    //MessageBox.Show("从" + create_time.ToString() + "到" + end_time.ToString() + "，没有数据");
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getOutpatient_Record_DataTable(create_time,access);
                    step_time_num = dta.Rows.Count;
                }
                #endregion
                ////如果存入的dta只有一行(即已经存在于表中的这一行)，则时间步进加1
                //if (dta.Rows.Count == 1)
                //{
                //    create_time = access.Add_Create_Time(create_time);
                //    dta = getdb.getOutpatient_Record_DataTable(create_time);
                //}

                //将dta导入实体Bean中
              
                
                    for (int i = 0; i < dta.Rows.Count; i++)
                    {
                        #region 表属性填充
                        Outpatient_Record outpatient_record = new Outpatient_Record();

                        #region 医疗机构代码
                        outpatient_record.YLJGDM = dta.Rows[i]["c_str_000"].ToString();
                        #endregion

                        #region 就诊流水号
                        outpatient_record.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_023"]);
                        #endregion

                        #region 病人ID
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_022"]))
                        {
                            outpatient_record.PatientID = 000;
                        }
                        else 
                        {
                            outpatient_record.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_022"]);
                        }
                        #endregion

                        #region 卡号
                        if (Convert.IsDBNull(dta.Rows[i]["c_str_028"]))
                        {
                            outpatient_record.KH = "不明";
                        }
                        else
                        {
                            outpatient_record.KH = dta.Rows[i]["c_str_028"].ToString();
                        }
                        #endregion

                        #region 卡类型
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_026"]))
                        {
                            outpatient_record.KLX = "不明";
                        }
                        else if (dta.Rows[i]["c_int_026"].ToString() == "0")
                        {
                            outpatient_record.KLX = "社保卡";
                        }
                        else if (dta.Rows[i]["c_int_026"].ToString() == "1")
                        {
                            outpatient_record.KLX = "医保卡";
                        }
                        else if (dta.Rows[i]["c_int_026"].ToString() == "2")
                        {
                            outpatient_record.KLX = "医联卡";
                        }
                        else if (dta.Rows[i]["c_int_026"].ToString() == "3")
                        {
                            outpatient_record.KLX = "医院就医卡";
                        }
                        else if (dta.Rows[i]["c_int_026"].ToString() == "9")
                        {
                            outpatient_record.KLX = "其他";
                        }
                        #endregion

                        #region 门诊号
                        outpatient_record.MZH = dta.Rows[i]["c_str_010"].ToString();
                        #endregion

                        #region  门诊挂号类型
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_025"]))
                        {
                            outpatient_record.MZGHLX = "不明";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "91")
                        {
                            outpatient_record.MZGHLX = "普通门诊";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "92")
                        {
                            outpatient_record.MZGHLX = "义诊";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "93")
                        {
                            outpatient_record.MZGHLX = "普通专病门诊";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "94" || dta.Rows[i]["c_int_025"].ToString() == "121")
                        {
                            outpatient_record.MZGHLX = "主任医师";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "95" || dta.Rows[i]["c_int_025"].ToString() == "122")
                        {
                            outpatient_record.MZGHLX = "副主任医师";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "96" || dta.Rows[i]["c_int_025"].ToString() == "98" || dta.Rows[i]["c_int_025"].ToString() == "106" || dta.Rows[i]["c_int_025"].ToString() == "130")
                        {
                            outpatient_record.MZGHLX = "空号";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "97" || dta.Rows[i]["c_int_025"].ToString() == "124")
                        {
                            outpatient_record.MZGHLX = "过敏";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "99" || dta.Rows[i]["c_int_025"].ToString() == "125")
                        {
                            outpatient_record.MZGHLX = "体检";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "100")
                        {
                            outpatient_record.MZGHLX = "外来医疗";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "101")
                        {
                            outpatient_record.MZGHLX = "特需体检";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "102")
                        {
                            outpatient_record.MZGHLX = "不点名专家";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "103" || dta.Rows[i]["c_int_025"].ToString() == "114")
                        {
                            outpatient_record.MZGHLX = "点名专家1";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "104" || dta.Rows[i]["c_int_025"].ToString() == "115")
                        {
                            outpatient_record.MZGHLX = "点名专家2";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "105" || dta.Rows[i]["c_int_025"].ToString() == "129")
                        {
                            outpatient_record.MZGHLX = "急诊";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "107" || dta.Rows[i]["c_int_025"].ToString() == "131")
                        {
                            outpatient_record.MZGHLX = "急诊空号";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "108" || dta.Rows[i]["c_int_025"].ToString() == "116")
                        {
                            outpatient_record.MZGHLX = "点名专家3";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "109")
                        {
                            outpatient_record.MZGHLX = "主任医师";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "110" || dta.Rows[i]["c_int_025"].ToString() == "132")
                        {
                            outpatient_record.MZGHLX = "减免普通";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "111" || dta.Rows[i]["c_int_025"].ToString() == "133")
                        {
                            outpatient_record.MZGHLX = "减免专病";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "112" || dta.Rows[i]["c_int_025"].ToString() == "134")
                        {
                            outpatient_record.MZGHLX = "减免急诊";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "113")
                        {
                            outpatient_record.MZGHLX = "专病空号";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "123")
                        {
                            outpatient_record.MZGHLX = "点名高级专家";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "126")
                        {
                            outpatient_record.MZGHLX = "外来医疗";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "127")
                        {
                            outpatient_record.MZGHLX = "不点名专家";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "128")
                        {
                            outpatient_record.MZGHLX = "著名专家";
                        }
                        else if (dta.Rows[i]["c_int_025"].ToString() == "135")
                        {
                            outpatient_record.MZGHLX = "高级著名专家";
                        }
                        #endregion

                        #region 姓名
                        outpatient_record.XM = dta.Rows[i]["c_str_034"].ToString();
                        #endregion

                        #region 就诊类型
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                        {
                            outpatient_record.JZLX = "不明";
                        }
                        else if (dta.Rows[i]["c_int_000"].ToString() == "0")
                        {
                            outpatient_record.JZLX = "门诊";
                        }
                        else if (dta.Rows[i]["c_int_000"].ToString() == "1")
                        {
                            outpatient_record.JZLX = "住院";
                        }
                        #endregion

                        #region 就诊状态
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                        {
                            outpatient_record.JZZT = "不明";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "101")
                        {
                            outpatient_record.JZZT = "待诊";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "102")
                        {
                            outpatient_record.JZZT = "在就诊";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "103")
                        {
                            outpatient_record.JZZT = "挂起";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "104")
                        {
                            outpatient_record.JZZT = "就诊结束";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "201")
                        {
                            outpatient_record.JZZT = "待入院";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "202")
                        {
                            outpatient_record.JZZT = "已入院";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "203")
                        {
                            outpatient_record.JZZT = "待入区";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "204")
                        {
                            outpatient_record.JZZT = "已入区";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "205")
                        {
                            outpatient_record.JZZT = "转区接待收";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "206")
                        {
                            outpatient_record.JZZT = "已出区";
                        }
                        else if (dta.Rows[i]["c_int_001"].ToString() == "207")
                        {
                            outpatient_record.JZZT = "已出院";
                        }                        
                        #endregion

                        #region 就诊科室编码
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                        {
                            outpatient_record.JZKSBM = 000;
                        }
                        else
                        {
                            outpatient_record.JZKSBM = Convert.ToInt32(dta.Rows[i]["c_int_002"]);
                        }
                        #endregion

                        #region 就诊科室名称
                        if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                        {
                            outpatient_record.JZKSMC = "不明";

                        }
                        else
                        {
                            outpatient_record.JZKSMC = dta.Rows[i]["c_str_001"].ToString();
                        }
                        #endregion

                        #region 就诊诊断编码
                        if (Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                        {
                            outpatient_record.JZZDBM = "不明";
                        }
                        else
                        {
                            outpatient_record.JZZDBM = dta.Rows[i]["c_str_011"].ToString();
                        }
                        #endregion

                        #region 就诊诊断名称
                        if (Convert.IsDBNull(dta.Rows[i]["c_str_012"]))
                        {
                            outpatient_record.JZZDMC = "不明";
                        }
                        else
                        {
                            outpatient_record.JZZDMC = dta.Rows[i]["c_str_012"].ToString();
                        }
                        #endregion

                        #region 主诊医生工号
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_013"]))
                        {
                            outpatient_record.ZZYSGH = 000;
                        }
                        else
                        {
                            outpatient_record.ZZYSGH = Convert.ToInt32(dta.Rows[i]["c_int_013"]);
                        }
                        #endregion

                        #region 主诊医生姓名
                        if (Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                        {
                            outpatient_record.ZZYSXM = "不明";
                        }
                        else
                        {
                            outpatient_record.ZZYSXM = dta.Rows[i]["c_str_002"].ToString();
                        }
                        #endregion

                        #region 病人费别代码
                        outpatient_record.BRFBDM = Convert.ToInt32(dta.Rows[i]["c_int_021"]);
                        #endregion

                        #region 挂号日期
                        if (Convert.IsDBNull(dta.Rows[i]["c_date_004"]))
                        {
                            outpatient_record.GHRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                        }
                        else
                        {
                            outpatient_record.GHRQ = Convert.ToDateTime(dta.Rows[i]["c_date_004"]);			
                        }
                        #endregion

                        #region 就诊日期
                        if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                        {
                            outpatient_record.JZRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                        }
                        else
                        {
                            outpatient_record.JZRQ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);			
                        }
                        #endregion

                        #region 挂起开始时间
                        if (Convert.IsDBNull(dta.Rows[i]["c_date_002"]))
                        {
                            outpatient_record.GQKSRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                        }
                        else
                        {
                            outpatient_record.GQKSRQ = Convert.ToDateTime(dta.Rows[i]["c_date_002"]);
                        }
                        #endregion

                        #region 挂起结束时间
                        if (Convert.IsDBNull(dta.Rows[i]["c_date_003"]))
                        {
                            outpatient_record.GQJSRQ = Convert.ToDateTime("1800-01-01 00:00:00"); ;
                        }
                        else
                        {
                            outpatient_record.GQJSRQ = Convert.ToDateTime(dta.Rows[i]["c_date_003"]);			
                        }
                        #endregion

                        #region 创建时间
                        outpatient_record.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                        #endregion

                        #region 其他属性
                        outpatient_record.XGBZ = 0;
                        outpatient_record.YLYL1 = null;
                        outpatient_record.YLYL2 = null;
                        #endregion

                        list.Add(outpatient_record);
                        #endregion
                        //取出表中最大的时间
                        if (i == dta.Rows.Count - 1)
                        {
                            create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                        }
                    }
                    access.InsertList(list,bar);
                    list.Clear();
                    dta.Clear();
                    //bar.ProbarAdd();
                          
            

                //int cnt = Num.GetCount("Outpatient_Record", create_time, end_time);
                MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");
                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }        
        }
        

        /// <summary>
        /// 从GetDB的DataTable将住院记录表存入数据库
        /// </summary>
        /// <param name=""></param>
        public void InPatient_Record_TransByDB()
        {
            Inpatient_RecordAccess access = new Inpatient_RecordAccess();
            List<Inpatient_Record> list = new List<Inpatient_Record>();
            //Inpatient_Record inpatient_record = new Inpatient_Record();

            GetDB getdb = new GetDB();                              //调用GetDB类
            DataTable dta = new DataTable();                          //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-06-22 10:25:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Inpatient_Record"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);       //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            int point_time_num;      //开始时间点的数据数
            int step_time_num;           //要取时间段的数据数

            //bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //取3天的数据
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getInpatient_Record_DataTable(create_time,access);
                point_time_num = Num.GetCount2("Inpatient_Record", create_time);
                step_time_num = dta.Rows.Count;


                //若这个时间段无数据
                while (point_time_num == step_time_num || dta.Rows.Count == 0)
                {
                    //MessageBox.Show("从" + create_time.ToString() + "到" + end_time.ToString() + "，没有数据");
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getInpatient_Record_DataTable(create_time,access);
                    step_time_num = dta.Rows.Count;
                }
                ////如果存入的dta只有一行(即已经存在于表中的这一行)，则时间步进加1
                //if (dta.Rows.Count == 1)
                //{
                //    create_time = access.Add_Create_Time(create_time);
                //    dta = getdb.getInpatient_Record_DataTable(create_time);
                //}

                //将dta导入实体Bean中

                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Inpatient_Record inpatient_record = new Inpatient_Record();
                    #region 表属性填充

                    #region 医疗机构代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        inpatient_record.YLJGDM = "不明";
                    }
                    else
                    {
                        inpatient_record.YLJGDM = dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    inpatient_record.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_023"]);
                    #endregion

                    #region 病人ID
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_022"]))
                    {
                        inpatient_record.PatientID = 000;
                    }
                    else
                    {
                        inpatient_record.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_022"]);
                    }
                    #endregion

                    #region 卡号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_028"]))
                    {
                        inpatient_record.KH = "不明";
                    }
                    else
                    {
                        inpatient_record.KH = dta.Rows[i]["c_str_028"].ToString();
                    }
                    #endregion

                    #region 卡类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_026"]))
                    {
                        inpatient_record.KLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_026"].ToString() == "0")
                    {
                        inpatient_record.KLX = "社保卡";
                    }
                    else if (dta.Rows[i]["c_int_026"].ToString() == "1")
                    {
                        inpatient_record.KLX = "医保卡";
                    }
                    else if (dta.Rows[i]["c_int_026"].ToString() == "2")
                    {
                        inpatient_record.KLX = "医联卡";
                    }
                    else if (dta.Rows[i]["c_int_026"].ToString() == "3")
                    {
                        inpatient_record.KLX = "医院就医卡";
                    }
                    else if (dta.Rows[i]["c_int_026"].ToString() == "9")
                    {
                        inpatient_record.KLX = "其他";
                    }
                    #endregion

                    #region 住院号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_006"]))
                    {
                        inpatient_record.ZYH = "不明";
                    }
                    else
                    {
                        inpatient_record.ZYH = dta.Rows[i]["c_str_006"].ToString();
                    }
                    #endregion

                    #region 姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_034"]))
                    {
                        inpatient_record.XM = "不明";
                    }
                    else
                    {
                        inpatient_record.XM = dta.Rows[i]["c_str_034"].ToString();
                    }
                    #endregion

                    #region 就诊类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        inpatient_record.JZLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "0")
                    {
                        inpatient_record.JZLX = "门诊";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "1")
                    {
                        inpatient_record.JZLX = "住院";
                    }
                    #endregion

                    #region 就诊状态
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                    {
                        inpatient_record.JZZT = "不明";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "202")
                    {
                        inpatient_record.JZZT = "已入院";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "204")
                    {
                        inpatient_record.JZZT = "已入区";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "206")
                    {
                        inpatient_record.JZZT = "已出区";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "207")
                    {
                        inpatient_record.JZZT = "已出院";
                    }
                    #endregion

                    #region 出院方式
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        inpatient_record.CYFS = "不明";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "1")
                    {
                        inpatient_record.CYFS = "治愈";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "2")
                    {
                        inpatient_record.CYFS = "好转";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "3")
                    {
                        inpatient_record.CYFS = "未愈";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "4")
                    {
                        inpatient_record.CYFS = "死亡";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "5")
                    {
                        inpatient_record.CYFS = "转院";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "9")
                    {
                        inpatient_record.CYFS = "其他";
                    }
                    #endregion

                    #region 住院次数
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_006"]))
                    {
                        inpatient_record.ZYCS = 000;
                    }
                    else
                    {
                        inpatient_record.ZYCS = Convert.ToInt32(dta.Rows[i]["c_int_006"]);
                    }
                    #endregion

                    #region 病区代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        inpatient_record.BQDM = 000;
                    }
                    else
                    {
                        inpatient_record.BQDM = Convert.ToInt32(dta.Rows[i]["c_int_009"]);
                    }
                    #endregion

                    #region 病区名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_007"]))
                    {
                        inpatient_record.BQMC = "不明";
                    }
                    else
                    {
                        inpatient_record.BQMC = dta.Rows[i]["c_str_007"].ToString();
                    }
                    #endregion

                    #region 就诊科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        inpatient_record.JZKSBM = 000;
                    }
                    else
                    {
                        inpatient_record.JZKSBM = Convert.ToInt32(dta.Rows[i]["c_int_002"]);
                    }
                    #endregion

                    #region 就诊科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        inpatient_record.JZKSMC = "不明";
                    }
                    else
                    {
                        inpatient_record.JZKSMC = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 入院诊断编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_009"]))
                    {
                        inpatient_record.RYZDBM = "不明";
                    }
                    else
                    {
                        inpatient_record.RYZDBM = dta.Rows[i]["c_str_009"].ToString();
                    }
                    #endregion

                    #region 入院诊断名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_010"]))
                    {
                        inpatient_record.RYZDMC = "不明";
                    }
                    else
                    {
                        inpatient_record.RYZDMC = dta.Rows[i]["c_str_010"].ToString();
                    }
                    #endregion

                    #region 出院诊断编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        inpatient_record.CYZDBM = "不明";
                    }
                    else
                    {
                        inpatient_record.CYZDBM = dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion

                    #region 出院诊断名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_012"]))
                    {
                        inpatient_record.CYZDMC = "不明";
                    }
                    else
                    {
                        inpatient_record.CYZDMC = dta.Rows[i]["c_str_012"].ToString();
                    }
                    #endregion                  
                   
                    #region 病人费别代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_021"]))
                    {
                        inpatient_record.BRFBDM = 000;
                    }
                    else
                    {
                        inpatient_record.BRFBDM = Convert.ToInt32(dta.Rows[i]["c_int_021"]);
                    }
                    #endregion                   

                    #region 就诊开始日期
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_037"]))
                    {
                        inpatient_record.JZKSRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.JZKSRQ = Convert.ToDateTime(dta.Rows[i]["c_str_037"]);
                    }
                    #endregion

                    #region 入院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        inpatient_record.RYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.RYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion

                    #region 预出院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_003"]))
                    {
                        inpatient_record.YCYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.YCYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_003"]);
                    }
                    #endregion

                    #region 出院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_002"]))
                    {
                        inpatient_record.CYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.CYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_002"]);
                    }
                    #endregion

                    #region 入病区时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_005"]))
                    {
                        inpatient_record.RBQSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.RBQSJ = Convert.ToDateTime(dta.Rows[i]["c_date_005"]);
                    }
                    #endregion

                    #region 出病区时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_006"]))
                    {
                        inpatient_record.CBQSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.CBQSJ = Convert.ToDateTime(dta.Rows[i]["c_date_006"]);
                    }
                    #endregion

                    #region 结算时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_001"]))
                    {
                        inpatient_record.JSSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.JSSJ = Convert.ToDateTime(dta.Rows[i]["c_date_001"]);
                    }
                    #endregion

                    #region 住院结算时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_004"]))
                    {
                        inpatient_record.ZYJSSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_record.ZYJSSJ = Convert.ToDateTime(dta.Rows[i]["c_date_004"]);
                    }
                    #endregion

                    #region 创建时间
                    inpatient_record.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    #endregion

                    #region 其他
                    inpatient_record.XGBZ = 0;
                    inpatient_record.YLYL1 = null;
                    inpatient_record.YLYL2 = null;
                    #endregion

                    #endregion
                    list.Add(inpatient_record);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                }

                access.InsertList(list,bar);
                list.Clear();
                dta.Clear();
                //DateTime end_time = access.Add_Create_Time(create_time);
                //int cnt = MaxNum.GetCount("Inpatient_Record", create_time, end_time);
                MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }

        /// <summary>
        /// 从GetDB的DataTable将门诊医嘱明细表存入数据库
        /// </summary>
        /// <param name=""></param>
        public void Outpatient_DrAdvice_Detail_TransByDB()
        {
            Outpatient_DrAdvice_DetailAccess access = new Outpatient_DrAdvice_DetailAccess();
            List<Outpatient_DrAdvice_Detail> list = new List<Outpatient_DrAdvice_Detail>();
            //Outpatient_DrAdvice_Detail outpatient_dr_detail = new Outpatient_DrAdvice_Detail();

            GetDB getdb = new GetDB();                              //调用GetDB类
            DataTable dta = new DataTable();                          //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-21 15:59:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Outpatient_DrAdvice_Detail"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);       //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            int point_time_num;      //开始时间点的数据数
            int step_time_num;           //要取时间段的数据数

            //bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //取3天的数据
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getOutpatient_DrAdvice_Detail_DataTable(create_time,access);
                
                point_time_num = Num.GetCount2("Outpatient_DrAdvice_Detail", create_time);
                step_time_num = dta.Rows.Count;


                //若这个时间段无数据
                //while (point_time_num == step_time_num || dta.Rows.Count == 0)
                //{
                //    //MessageBox.Show("从" + create_time.ToString() + "到" + end_time.ToString() + "，没有数据");
                //    create_time = end_time;
                //    end_time = access.Add_Create_Time(create_time);
                //    dta = getdb.getOutpatient_DrAdvice_Detail_DataTable(create_time, access);
                // //   point_time_num = Num.GetCount2("Outpatient_DrAdvice_Detail", create_time);
                //    step_time_num = dta.Rows.Count;
                //}
                //如果存入的dta只有一行(即已经存在于表中的这一行)，则时间步进加1
                //if (dta.Rows.Count == 1)
                //{
                //    create_time = access.Add_Create_Time(create_time);
                //    dta = getdb.getOut_DrAdvice_Detail_DataTable(create_time);
                //}

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Outpatient_DrAdvice_Detail outpatient_dr_detail = new Outpatient_DrAdvice_Detail();
                    #region 表属性填充

                    #region 医疗机构代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_020"]))
                    {
                        outpatient_dr_detail.YLJGDM = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YLJGDM = dta.Rows[i]["c_str_020"].ToString();
                    }
                    #endregion

                    #region 医嘱序号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_040"]))
                    {
                        outpatient_dr_detail.YZXH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.YZXH = Convert.ToInt32(dta.Rows[i]["c_int_040"]);
                    }
                    #endregion

                    #region 就诊流水号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_036"]))
                    {
                        outpatient_dr_detail.JZLSH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_036"]);
                    }
                    #endregion

                    #region 病人标识ID
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_006"]))
                    {
                        outpatient_dr_detail.PatientID = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_006"]);
                    }
                    #endregion

                    #region 卡号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_019"]))
                    {
                        outpatient_dr_detail.KH = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.KH = dta.Rows[i]["c_str_019"].ToString();
                    }
                    #endregion

                    #region 医嘱ID
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_043"]))
                    {
                        outpatient_dr_detail.YZID = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZID = dta.Rows[i]["c_str_043"].ToString();
                    }
                    #endregion

                    #region 处方号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_027"]))
                    {
                        outpatient_dr_detail.CFH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.CFH = Convert.ToInt32(dta.Rows[i]["c_int_027"]);
                    }
                    #endregion

                    #region 医嘱状态
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        outpatient_dr_detail.YZZT = "不明";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "1")
                    {
                        outpatient_dr_detail.YZZT = "待审";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "2")
                    {
                        outpatient_dr_detail.YZZT = "审核";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "3")
                    {
                        outpatient_dr_detail.YZZT = "执行";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "4")
                    {
                        outpatient_dr_detail.YZZT = "收费";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "5")
                    {
                        outpatient_dr_detail.YZZT = "取消";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "6")
                    {
                        outpatient_dr_detail.YZZT = "停止";
                    }
                    #endregion

                    #region 长期医嘱标志
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_014"]))
                    {
                        outpatient_dr_detail.CQYZBZ = "不明";
                    }
                    else if (dta.Rows[i]["c_int_014"].ToString() == "0")
                    {
                        outpatient_dr_detail.CQYZBZ = "否";
                    }
                    else if (dta.Rows[i]["c_int_014"].ToString() == "1")
                    {
                        outpatient_dr_detail.CQYZBZ = "是";
                    }
                    #endregion

                    #region 医嘱类型编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_025"]))
                    {
                        outpatient_dr_detail.YBYPBM = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZLXBM = dta.Rows[i]["c_str_025"].ToString();
                    }
                    #endregion

                    #region 医嘱类别
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_007"]))
                    {
                        outpatient_dr_detail.YZLB = "不明";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "0")
                    {
                        outpatient_dr_detail.YZLB = "药品";
                    }

                    else if (dta.Rows[i]["c_int_007"].ToString() == "1")
                    {
                        outpatient_dr_detail.YZLB = "治疗";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "2")
                    {
                        outpatient_dr_detail.YZLB = "手术";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "3")
                    {
                        outpatient_dr_detail.YZLB = "麻醉";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "4")
                    {
                        outpatient_dr_detail.YZLB = "膳食";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "5")
                    {
                        outpatient_dr_detail.YZLB = "输血";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "6")
                    {
                        outpatient_dr_detail.YZLB = "护理";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "7")
                    {
                        outpatient_dr_detail.YZLB = "床位";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "8")
                    {
                        outpatient_dr_detail.YZLB = "检查";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "9")
                    {
                        outpatient_dr_detail.YZLB = "检验";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "10")
                    {
                        outpatient_dr_detail.YZLB = "输液";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "11")
                    {
                        outpatient_dr_detail.YZLB = "材料";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "12")
                    {
                        outpatient_dr_detail.YZLB = "转科";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "13")
                    {
                        outpatient_dr_detail.YZLB = "转床";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "14")
                    {
                        outpatient_dr_detail.YZLB = "出院";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "15")
                    {
                        outpatient_dr_detail.YZLB = "出院带药";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "16")
                    {
                        outpatient_dr_detail.YZLB = "其他";
                    }
                    #endregion

                    #region 医嘱说明
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_034"]))
                    {
                        outpatient_dr_detail.YZSM = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZSM = dta.Rows[i]["c_str_034"].ToString();
                    }
                    #endregion

                    #region 科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_025"]))
                    {
                        outpatient_dr_detail.KSDM = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.KSDM = Convert.ToInt32(dta.Rows[i]["c_int_025"]);
                    }
                    #endregion

                    #region 科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        outpatient_dr_detail.KSMC = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.KSMC = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 医嘱下达科室
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_022"]))
                    {
                        outpatient_dr_detail.YZXDKS = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZXDKS = dta.Rows[i]["c_str_022"].ToString();
                    }
                    #endregion

                    #region 医嘱执行科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_017"]))
                    {
                        outpatient_dr_detail.YZZXKSBM = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.YZZXKSBM = Convert.ToInt32(dta.Rows[i]["c_int_017"]);
                    }
                    #endregion

                    #region 医嘱执行科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_006"]))
                    {
                        outpatient_dr_detail.YZZXKSMC = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZZXKSMC = dta.Rows[i]["c_str_006"].ToString();
                    }
                    #endregion

                    #region 医嘱下达人工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_008"]))
                    {
                        outpatient_dr_detail.XDRGH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.XDRGH = Convert.ToInt32(dta.Rows[i]["c_int_008"]);
                    }
                    #endregion

                    #region 医嘱下达人姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        outpatient_dr_detail.XDRXM = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.XDRXM = dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 医嘱执行人工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_023"]))
                    {
                        outpatient_dr_detail.ZXRGH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.ZXRGH = Convert.ToInt32(dta.Rows[i]["c_str_023"]);
                    }
                    #endregion

                    #region 医嘱执行人姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_024"]))
                    {
                        outpatient_dr_detail.ZXRXM = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.ZXRXM = dta.Rows[i]["c_str_024"].ToString();
                    }
                    #endregion

                    #region 医嘱审核人工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_021"]))
                    {
                        outpatient_dr_detail.YZSHRGH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.YZSHRGH = Convert.ToInt32(dta.Rows[i]["c_int_021"]);
                    }
                    #endregion

                    #region 医嘱停止医生工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_018"]))
                    {
                        outpatient_dr_detail.YZTZYSGH = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.YZTZYSGH = Convert.ToInt32(dta.Rows[i]["c_int_018"]);
                    }
                    #endregion

                    #region 医嘱明细编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_023"]))
                    {
                        outpatient_dr_detail.YZMXBM = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.YZMXBM = Convert.ToInt32(dta.Rows[i]["c_int_023"]);
                    }
                    #endregion

                    #region 医嘱明细名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        outpatient_dr_detail.YZMXMC = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZMXMC = dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 医保药品编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_041"]))
                    {
                        outpatient_dr_detail.YBYPBM = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YBYPBM = dta.Rows[i]["c_str_041"].ToString();
                    }
                    #endregion

                    #region 数量
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_002"]))
                    {
                        outpatient_dr_detail.SL = 0;
                    }
                    else
                    {
                        outpatient_dr_detail.SL = Convert.ToDecimal(dta.Rows[i]["c_float_002"]);
                    }
                    #endregion

                    #region 医嘱领取最小单位
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_005"]))
                    {
                        outpatient_dr_detail.YZLQZXDW = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZLQZXDW = dta.Rows[i]["c_str_005"].ToString();
                    }
                    #endregion

                    #region 药品规格
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_008"]))
                    {
                        outpatient_dr_detail.YPGG = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YPGG = dta.Rows[i]["c_str_008"].ToString();
                    }
                    #endregion

                    #region 剂量系数
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_001"]))
                    {
                        outpatient_dr_detail.JLXS = 0;
                    }
                    else
                    {
                        outpatient_dr_detail.JLXS = Convert.ToDecimal(dta.Rows[i]["c_float_001"]);
                    }
                    #endregion

                    #region 用药剂量
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_009"]))
                    {
                        outpatient_dr_detail.YYJL = 0;
                    }
                    else
                    {
                        outpatient_dr_detail.YYJL = Convert.ToDecimal(dta.Rows[i]["c_float_009"]);
                    }
                    #endregion

                    #region 剂量单位
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_037"]))
                    {
                        outpatient_dr_detail.JLDW = "不明";
                    }
                    else if(dta.Rows[i]["c_int_037"].ToString() == "2"){outpatient_dr_detail.JLDW = "10盒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "3"){outpatient_dr_detail.JLDW = "AMP";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "4"){outpatient_dr_detail.JLDW = "APM";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "5"){outpatient_dr_detail.JLDW = "AU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "6"){outpatient_dr_detail.JLDW = "B";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "7"){outpatient_dr_detail.JLDW = "BAB";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "8"){outpatient_dr_detail.JLDW = "BAG";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "9"){outpatient_dr_detail.JLDW = "BAT";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "10"){outpatient_dr_detail.JLDW = "BOA";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "11"){outpatient_dr_detail.JLDW = "BOG";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "12"){outpatient_dr_detail.JLDW = "BOT";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "13"){outpatient_dr_detail.JLDW = "BOX";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "14"){outpatient_dr_detail.JLDW = "BTO";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "15"){outpatient_dr_detail.JLDW = "bu";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "16"){outpatient_dr_detail.JLDW = "c";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "17"){outpatient_dr_detail.JLDW = "CAN";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "18"){outpatient_dr_detail.JLDW = "cm2";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "19"){outpatient_dr_detail.JLDW = "CO";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "20"){outpatient_dr_detail.JLDW = "DOT";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "21"){outpatient_dr_detail.JLDW = "DROP";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "22"){outpatient_dr_detail.JLDW = "EPU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "23"){outpatient_dr_detail.JLDW = "g";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "24"){outpatient_dr_detail.JLDW = "G";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "25"){outpatient_dr_detail.JLDW = "g/ml";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "26"){outpatient_dr_detail.JLDW = "iu";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "27"){outpatient_dr_detail.JLDW = "IU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "28"){outpatient_dr_detail.JLDW = "kg";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "29"){outpatient_dr_detail.JLDW = "KU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "30"){outpatient_dr_detail.JLDW = "L";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "31"){outpatient_dr_detail.JLDW = "Lsu";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "32"){outpatient_dr_detail.JLDW = "M";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "33"){outpatient_dr_detail.JLDW = "mci";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "34"){outpatient_dr_detail.JLDW = "mg";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "35"){outpatient_dr_detail.JLDW = "MG";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "36"){outpatient_dr_detail.JLDW = "MISC";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "37"){outpatient_dr_detail.JLDW = "miu";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "38"){outpatient_dr_detail.JLDW = "ml";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "39"){outpatient_dr_detail.JLDW = "ML";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "40"){outpatient_dr_detail.JLDW = "NOX";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "41"){outpatient_dr_detail.JLDW = "NULL";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "42"){outpatient_dr_detail.JLDW = "OINT";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "43"){outpatient_dr_detail.JLDW = "PE";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "44"){outpatient_dr_detail.JLDW = "SING";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "45"){outpatient_dr_detail.JLDW = "SOLN";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "46"){outpatient_dr_detail.JLDW = "SPRA";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "47"){outpatient_dr_detail.JLDW = "T";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "48"){outpatient_dr_detail.JLDW = "TAB";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "49"){outpatient_dr_detail.JLDW = "TOX";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "50"){outpatient_dr_detail.JLDW = "TUBE";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "51"){outpatient_dr_detail.JLDW = "TUBM";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "52"){outpatient_dr_detail.JLDW = "TUMB";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "53"){outpatient_dr_detail.JLDW = "TUNE";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "54"){outpatient_dr_detail.JLDW = "U";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "55"){outpatient_dr_detail.JLDW = "u";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "56"){outpatient_dr_detail.JLDW = "ug";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "57"){outpatient_dr_detail.JLDW = "UG";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "58"){outpatient_dr_detail.JLDW = "VAIL";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "59"){outpatient_dr_detail.JLDW = "VIAL";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "60"){outpatient_dr_detail.JLDW = "VILN";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "61"){outpatient_dr_detail.JLDW = "XX";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "62"){outpatient_dr_detail.JLDW = "YUBE";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "63"){outpatient_dr_detail.JLDW = "安瓿";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "64"){outpatient_dr_detail.JLDW = "百万";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "65"){outpatient_dr_detail.JLDW = "板";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "66"){outpatient_dr_detail.JLDW = "包";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "67"){outpatient_dr_detail.JLDW = "本";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "68"){outpatient_dr_detail.JLDW = "次";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "69"){outpatient_dr_detail.JLDW = "大袋";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "70"){outpatient_dr_detail.JLDW = "大盒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "71"){outpatient_dr_detail.JLDW = "大扎";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "72"){outpatient_dr_detail.JLDW = "代";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "73"){outpatient_dr_detail.JLDW = "袋";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "75"){outpatient_dr_detail.JLDW = "单位";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "76"){outpatient_dr_detail.JLDW = "滴瓶";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "77"){outpatient_dr_detail.JLDW = "对";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "78"){outpatient_dr_detail.JLDW = "份";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "79"){outpatient_dr_detail.JLDW = "格";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "80"){outpatient_dr_detail.JLDW = "个";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "81"){outpatient_dr_detail.JLDW = "管";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "82"){outpatient_dr_detail.JLDW = "罐";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "83"){outpatient_dr_detail.JLDW = "罐桶";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "84"){outpatient_dr_detail.JLDW = "广口";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "85"){outpatient_dr_detail.JLDW = "国际";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "86"){outpatient_dr_detail.JLDW = "含片";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "87"){outpatient_dr_detail.JLDW = "毫升";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "88"){outpatient_dr_detail.JLDW = "盒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "89"){outpatient_dr_detail.JLDW = "剂";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "90"){outpatient_dr_detail.JLDW = "胶囊";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "92"){outpatient_dr_detail.JLDW = "克";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "93"){outpatient_dr_detail.JLDW = "块";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "94"){outpatient_dr_detail.JLDW = "粒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "95"){outpatient_dr_detail.JLDW = "枚";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "96"){outpatient_dr_detail.JLDW = "排";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "97"){outpatient_dr_detail.JLDW = "喷";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "98"){outpatient_dr_detail.JLDW = "批";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "99"){outpatient_dr_detail.JLDW = "片";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "100"){outpatient_dr_detail.JLDW = "瓶";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "101"){outpatient_dr_detail.JLDW = "其它";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "102"){outpatient_dr_detail.JLDW = "千张";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "103"){outpatient_dr_detail.JLDW = "揿";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "104"){outpatient_dr_detail.JLDW = "十亿";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "105"){outpatient_dr_detail.JLDW = "拴";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "106"){outpatient_dr_detail.JLDW = "塑瓶";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "107"){outpatient_dr_detail.JLDW = "套";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "108"){outpatient_dr_detail.JLDW = "条";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "109"){outpatient_dr_detail.JLDW = "贴";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "110"){outpatient_dr_detail.JLDW = "桶";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "111"){outpatient_dr_detail.JLDW = "筒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "112"){outpatient_dr_detail.JLDW = "透皮";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "113"){outpatient_dr_detail.JLDW = "丸";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "114"){outpatient_dr_detail.JLDW = "万";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "115"){outpatient_dr_detail.JLDW = "万iu";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "116"){outpatient_dr_detail.JLDW = "万U";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "117"){outpatient_dr_detail.JLDW = "万片";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "118"){outpatient_dr_detail.JLDW = "万套";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "119"){outpatient_dr_detail.JLDW = "微克";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "120"){outpatient_dr_detail.JLDW = "微升";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "121"){outpatient_dr_detail.JLDW = "西林";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "122"){outpatient_dr_detail.JLDW = "吸";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "123"){outpatient_dr_detail.JLDW = "锡管";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "124"){outpatient_dr_detail.JLDW = "匣";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "125"){outpatient_dr_detail.JLDW = "箱";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "126"){outpatient_dr_detail.JLDW = "小袋";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "127"){outpatient_dr_detail.JLDW = "小盒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "128"){outpatient_dr_detail.JLDW = "小扎";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "129"){outpatient_dr_detail.JLDW = "药条";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "130"){outpatient_dr_detail.JLDW = "杂类";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "131"){outpatient_dr_detail.JLDW = "张";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "132"){outpatient_dr_detail.JLDW = "支";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "133"){outpatient_dr_detail.JLDW = "中盒";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "134"){outpatient_dr_detail.JLDW = "co";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "135"){outpatient_dr_detail.JLDW = "s";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "136"){outpatient_dr_detail.JLDW = "万IU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "137"){outpatient_dr_detail.JLDW = "BU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "138"){outpatient_dr_detail.JLDW = "Co";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "139"){outpatient_dr_detail.JLDW = "百万iu";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "140"){outpatient_dr_detail.JLDW = "KIU";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "141"){outpatient_dr_detail.JLDW = "天";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "142"){outpatient_dr_detail.JLDW = "只";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "143"){outpatient_dr_detail.JLDW = "副";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "144"){outpatient_dr_detail.JLDW = "根";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "145"){outpatient_dr_detail.JLDW = "双";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "146"){outpatient_dr_detail.JLDW = "小时";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "147"){outpatient_dr_detail.JLDW = "件";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "148"){outpatient_dr_detail.JLDW = "ºÐ";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "149"){outpatient_dr_detail.JLDW = "Ö§";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "150"){outpatient_dr_detail.JLDW = "Æ¿";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "151"){outpatient_dr_detail.JLDW = "°ü";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "152"){outpatient_dr_detail.JLDW = "10ºÐ";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "153"){outpatient_dr_detail.JLDW = "box";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "154"){outpatient_dr_detail.JLDW = "´ü";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "155"){outpatient_dr_detail.JLDW = "°å";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "156"){outpatient_dr_detail.JLDW = "Æ¬";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "157"){outpatient_dr_detail.JLDW = "amp";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "158"){outpatient_dr_detail.JLDW = "Á£";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "159"){outpatient_dr_detail.JLDW = "bot";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "160"){outpatient_dr_detail.JLDW = "ÖÐºÐ";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "161"){outpatient_dr_detail.JLDW = "bag";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "162"){outpatient_dr_detail.JLDW = "´ú";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "163"){outpatient_dr_detail.JLDW = "vial";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "164"){outpatient_dr_detail.JLDW = "µ¥Î»";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "165"){outpatient_dr_detail.JLDW = "Ìù";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "166"){outpatient_dr_detail.JLDW = "Ìû";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "167"){outpatient_dr_detail.JLDW = "Þì";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "168"){outpatient_dr_detail.JLDW = "ËÜÆ¿";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "169"){outpatient_dr_detail.JLDW = "Ì×";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "170"){outpatient_dr_detail.JLDW = "Í°";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "171"){outpatient_dr_detail.JLDW = "%";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "172"){outpatient_dr_detail.JLDW = "1";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "173"){outpatient_dr_detail.JLDW = ".";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "174"){outpatient_dr_detail.JLDW = "100t";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "175"){outpatient_dr_detail.JLDW = "2t";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "176"){outpatient_dr_detail.JLDW = "'\'";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "177"){outpatient_dr_detail.JLDW = "6u";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "178"){outpatient_dr_detail.JLDW = "帖";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "179"){outpatient_dr_detail.JLDW = "中板";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "180"){outpatient_dr_detail.JLDW = "例";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "181"){outpatient_dr_detail.JLDW = "单侧";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "182"){outpatient_dr_detail.JLDW = "q8h";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "183"){outpatient_dr_detail.JLDW = "1.5M";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "184"){outpatient_dr_detail.JLDW = "把";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "185"){outpatient_dr_detail.JLDW = "公斤";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "186"){outpatient_dr_detail.JLDW = "付";}
                    else if(dta.Rows[i]["c_int_037"].ToString() == "187"){outpatient_dr_detail.JLDW = "卷";}
                    #endregion

                    #region 发药剂量
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_028"]))
                    {
                        outpatient_dr_detail.FYJL = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.FYJL = dta.Rows[i]["c_str_028"].ToString();
                    }
                    #endregion

                    #region 药品用法
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_003"]))
                    {
                        outpatient_dr_detail.YPYF = "不明";
                    }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "1") { outpatient_dr_detail.YPYF = "口服"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "2") { outpatient_dr_detail.YPYF = "含服"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "3") { outpatient_dr_detail.YPYF = "顿服"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "4") { outpatient_dr_detail.YPYF = "吞下"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "5") { outpatient_dr_detail.YPYF = "外用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "6") { outpatient_dr_detail.YPYF = "研粉"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "7") { outpatient_dr_detail.YPYF = "胃注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "8") { outpatient_dr_detail.YPYF = "漱口"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "9") { outpatient_dr_detail.YPYF = "冲管"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "10") { outpatient_dr_detail.YPYF = "肌肉注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "11") { outpatient_dr_detail.YPYF = "肌注化疗"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "12") { outpatient_dr_detail.YPYF = "皮下注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "13") { outpatient_dr_detail.YPYF = "喷雾"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "14") { outpatient_dr_detail.YPYF = "鼻饲"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "15") { outpatient_dr_detail.YPYF = "外敷"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "16") { outpatient_dr_detail.YPYF = "外涂"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "17") { outpatient_dr_detail.YPYF = "冲服"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "18") { outpatient_dr_detail.YPYF = "静脉推注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "19") { outpatient_dr_detail.YPYF = "静脉注射化疗"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "20") { outpatient_dr_detail.YPYF = "营养"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "21") { outpatient_dr_detail.YPYF = "局麻"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "22") { outpatient_dr_detail.YPYF = "静脉滴注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "23") { outpatient_dr_detail.YPYF = "含漱"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "24") { outpatient_dr_detail.YPYF = "球周注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "25") { outpatient_dr_detail.YPYF = "清洗"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "26") { outpatient_dr_detail.YPYF = "涂眼"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "27") { outpatient_dr_detail.YPYF = "造影"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "28") { outpatient_dr_detail.YPYF = "皮试"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "29") { outpatient_dr_detail.YPYF = "皮内注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "30") { outpatient_dr_detail.YPYF = "青霉素皮试"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "31") { outpatient_dr_detail.YPYF = "PDP皮试"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "32") { outpatient_dr_detail.YPYF = "局部封闭"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "33") { outpatient_dr_detail.YPYF = "局部浸润麻醉"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "34") { outpatient_dr_detail.YPYF = "自注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "35") { outpatient_dr_detail.YPYF = "喷喉"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "36") { outpatient_dr_detail.YPYF = "喷鼻"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "37") { outpatient_dr_detail.YPYF = "滴鼻"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "38") { outpatient_dr_detail.YPYF = "阴道用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "39") { outpatient_dr_detail.YPYF = "肛门用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "40") { outpatient_dr_detail.YPYF = "尿道用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "41") { outpatient_dr_detail.YPYF = "灌肠用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "42") { outpatient_dr_detail.YPYF = "搽患处"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "43") { outpatient_dr_detail.YPYF = "敷用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "44") { outpatient_dr_detail.YPYF = "滴眼"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "45") { outpatient_dr_detail.YPYF = "滴耳"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "46") { outpatient_dr_detail.YPYF = "舌下含服"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "47") { outpatient_dr_detail.YPYF = "心内注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "48") { outpatient_dr_detail.YPYF = "动脉加压注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "49") { outpatient_dr_detail.YPYF = "皮下输液"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "50") { outpatient_dr_detail.YPYF = "肛内用"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "51") { outpatient_dr_detail.YPYF = "小儿静脉输注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "52") { outpatient_dr_detail.YPYF = "穴位注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "53") { outpatient_dr_detail.YPYF = "酒精擦浴"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "54") { outpatient_dr_detail.YPYF = "雾化吸入"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "55") { outpatient_dr_detail.YPYF = "气泵吸入"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "56") { outpatient_dr_detail.YPYF = "坐浴"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "57") { outpatient_dr_detail.YPYF = "推拿"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "58") { outpatient_dr_detail.YPYF = "宫底注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "59") { outpatient_dr_detail.YPYF = "宫颈注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "60") { outpatient_dr_detail.YPYF = "煎服"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "61") { outpatient_dr_detail.YPYF = "其他"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "62") { outpatient_dr_detail.YPYF = "BID"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "63") { outpatient_dr_detail.YPYF = "CX"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "64") { outpatient_dr_detail.YPYF = "DY"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "65") { outpatient_dr_detail.YPYF = "GTT"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "66") { outpatient_dr_detail.YPYF = "ID"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "67") { outpatient_dr_detail.YPYF = "IH"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "68") { outpatient_dr_detail.YPYF = "IM"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "69") { outpatient_dr_detail.YPYF = "IV"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "70") { outpatient_dr_detail.YPYF = "IVG"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "71") { outpatient_dr_detail.YPYF = "IVGTT"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "72") { outpatient_dr_detail.YPYF = "NG"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "73") { outpatient_dr_detail.YPYF = "P.O"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "74") { outpatient_dr_detail.YPYF = "QD"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "75") { outpatient_dr_detail.YPYF = "qd1"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "76") { outpatient_dr_detail.YPYF = "QN"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "77") { outpatient_dr_detail.YPYF = "SK"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "78") { outpatient_dr_detail.YPYF = "SX"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "79") { outpatient_dr_detail.YPYF = "TID"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "80") { outpatient_dr_detail.YPYF = "WH"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "81") { outpatient_dr_detail.YPYF = "ZL"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "82") { outpatient_dr_detail.YPYF = "吸入"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "83") { outpatient_dr_detail.YPYF = "肌注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "84") { outpatient_dr_detail.YPYF = "静注"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "85") { outpatient_dr_detail.YPYF = "静滴"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "86") { outpatient_dr_detail.YPYF = "皮下"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "87") { outpatient_dr_detail.YPYF = "皮内"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "88") { outpatient_dr_detail.YPYF = "滴左眼"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "89") { outpatient_dr_detail.YPYF = "滴右眼"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "90") { outpatient_dr_detail.YPYF = "洗胃"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "91") { outpatient_dr_detail.YPYF = "洗耳"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "92") { outpatient_dr_detail.YPYF = "纳肛"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "93") { outpatient_dr_detail.YPYF = "灌肠"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "94") { outpatient_dr_detail.YPYF = "纳阴"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "95") { outpatient_dr_detail.YPYF = "膀胱冲洗"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "96") { outpatient_dr_detail.YPYF = "阴道冲洗剂"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "97") { outpatient_dr_detail.YPYF = "1汤匙"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "98") { outpatient_dr_detail.YPYF = "关节内注射"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "99") { outpatient_dr_detail.YPYF = "神经阻滞"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "100") { outpatient_dr_detail.YPYF = "睡前涂眼"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "101") { outpatient_dr_detail.YPYF = "骶管阻滞"; }
                    else if (dta.Rows[i]["c_int_003"].ToString() == "102") { outpatient_dr_detail.YPYF = "TIW"; }
                    #endregion

                    #region 用药频度
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_032"]))
                    {
                        outpatient_dr_detail.YYPC = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YYPC = dta.Rows[i]["c_str_032"].ToString();
                    }
                    #endregion

                    #region 医嘱频次编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_024"]))
                    {
                        outpatient_dr_detail.YZPCBM = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.YZPCBM = Convert.ToInt32(dta.Rows[i]["c_int_024"]);
                    }
                    #endregion

                    #region 医嘱频次名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        outpatient_dr_detail.YZPCMC = "不明";
                    }
                    else
                    {
                        outpatient_dr_detail.YZPCMC = dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion

                    #region 费用类别编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_038"]))
                    {
                        outpatient_dr_detail.FYLBBM = "不明";
                    }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "474") { outpatient_dr_detail.FYLBBM = "会诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "475") { outpatient_dr_detail.FYLBBM = "西药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "476") { outpatient_dr_detail.FYLBBM = "中成药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "477") { outpatient_dr_detail.FYLBBM = "化验费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "478") { outpatient_dr_detail.FYLBBM = "孕产期检验"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "479") { outpatient_dr_detail.FYLBBM = "治疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "480") { outpatient_dr_detail.FYLBBM = "医用材料费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "481") { outpatient_dr_detail.FYLBBM = "摄片费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "482") { outpatient_dr_detail.FYLBBM = "CT费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "483") { outpatient_dr_detail.FYLBBM = "检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "484") { outpatient_dr_detail.FYLBBM = "孕产期检查"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "485") { outpatient_dr_detail.FYLBBM = "核磁共振"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "486") { outpatient_dr_detail.FYLBBM = "输氧费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "487") { outpatient_dr_detail.FYLBBM = "输血费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "488") { outpatient_dr_detail.FYLBBM = "抢救费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "489") { outpatient_dr_detail.FYLBBM = "证书费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "490") { outpatient_dr_detail.FYLBBM = "饮食费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "491") { outpatient_dr_detail.FYLBBM = "病理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "492") { outpatient_dr_detail.FYLBBM = "住院费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "493") { outpatient_dr_detail.FYLBBM = "诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "494") { outpatient_dr_detail.FYLBBM = "三级医院诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "495") { outpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "496") { outpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "497") { outpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "498") { outpatient_dr_detail.FYLBBM = "点名专家1诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "499") { outpatient_dr_detail.FYLBBM = "点名专家2诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "500") { outpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "501") { outpatient_dr_detail.FYLBBM = "手术费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "502") { outpatient_dr_detail.FYLBBM = "透视费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "503") { outpatient_dr_detail.FYLBBM = "出诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "504") { outpatient_dr_detail.FYLBBM = "留观费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "505") { outpatient_dr_detail.FYLBBM = "其他"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "506") { outpatient_dr_detail.FYLBBM = "病史复印费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "507") { outpatient_dr_detail.FYLBBM = "健康检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "508") { outpatient_dr_detail.FYLBBM = "工本费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "509") { outpatient_dr_detail.FYLBBM = "磁卡费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "510") { outpatient_dr_detail.FYLBBM = "中草药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "511") { outpatient_dr_detail.FYLBBM = "护理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "588") { outpatient_dr_detail.FYLBBM = "特需门诊"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "589") { outpatient_dr_detail.FYLBBM = "核磁共振"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "590") { outpatient_dr_detail.FYLBBM = "证书费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "591") { outpatient_dr_detail.FYLBBM = "孕产期检查"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "592") { outpatient_dr_detail.FYLBBM = "病史复印费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "593") { outpatient_dr_detail.FYLBBM = "西药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "594") { outpatient_dr_detail.FYLBBM = "药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "595") { outpatient_dr_detail.FYLBBM = "医用材料费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "596") { outpatient_dr_detail.FYLBBM = "治疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "597") { outpatient_dr_detail.FYLBBM = "中草药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "598") { outpatient_dr_detail.FYLBBM = "检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "599") { outpatient_dr_detail.FYLBBM = "诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "600") { outpatient_dr_detail.FYLBBM = "其他"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "601") { outpatient_dr_detail.FYLBBM = "化验费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "602") { outpatient_dr_detail.FYLBBM = "摄片费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "603") { outpatient_dr_detail.FYLBBM = "输血费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "604") { outpatient_dr_detail.FYLBBM = "护理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "605") { outpatient_dr_detail.FYLBBM = "输氧费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "606") { outpatient_dr_detail.FYLBBM = "诊疗费(自)"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "607") { outpatient_dr_detail.FYLBBM = "出诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "608") { outpatient_dr_detail.FYLBBM = "CT费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "609") { outpatient_dr_detail.FYLBBM = "住院费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "610") { outpatient_dr_detail.FYLBBM = "手术费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "611") { outpatient_dr_detail.FYLBBM = "饮食费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "612") { outpatient_dr_detail.FYLBBM = "留观费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "613") { outpatient_dr_detail.FYLBBM = "抢救费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "614") { outpatient_dr_detail.FYLBBM = "健康检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "615") { outpatient_dr_detail.FYLBBM = "卧位"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "616") { outpatient_dr_detail.FYLBBM = "病危通知"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "617") { outpatient_dr_detail.FYLBBM = "出院通知"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "618") { outpatient_dr_detail.FYLBBM = "会诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "619") { outpatient_dr_detail.FYLBBM = "病理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "620") { outpatient_dr_detail.FYLBBM = "透视费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "621") { outpatient_dr_detail.FYLBBM = "死亡通知"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "622") { outpatient_dr_detail.FYLBBM = "西药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "623") { outpatient_dr_detail.FYLBBM = "中成药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "624") { outpatient_dr_detail.FYLBBM = "化验费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "625") { outpatient_dr_detail.FYLBBM = "治疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "626") { outpatient_dr_detail.FYLBBM = "医用材料费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "627") { outpatient_dr_detail.FYLBBM = "摄片费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "628") { outpatient_dr_detail.FYLBBM = "CT费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "629") { outpatient_dr_detail.FYLBBM = "检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "630") { outpatient_dr_detail.FYLBBM = "核磁共振"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "631") { outpatient_dr_detail.FYLBBM = "输氧费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "632") { outpatient_dr_detail.FYLBBM = "输血费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "633") { outpatient_dr_detail.FYLBBM = "抢救费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "634") { outpatient_dr_detail.FYLBBM = "证书费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "635") { outpatient_dr_detail.FYLBBM = "饮食费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "636") { outpatient_dr_detail.FYLBBM = "病理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "637") { outpatient_dr_detail.FYLBBM = "住院费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "638") { outpatient_dr_detail.FYLBBM = "诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "639") { outpatient_dr_detail.FYLBBM = "三级医院诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "640") { outpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "641") { outpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "642") { outpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "643") { outpatient_dr_detail.FYLBBM = "点名专家1诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "644") { outpatient_dr_detail.FYLBBM = "点名专家2诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "645") { outpatient_dr_detail.FYLBBM = "空号"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "646") { outpatient_dr_detail.FYLBBM = "手术费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "647") { outpatient_dr_detail.FYLBBM = "透视费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "648") { outpatient_dr_detail.FYLBBM = "出诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "649") { outpatient_dr_detail.FYLBBM = "留观费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "650") { outpatient_dr_detail.FYLBBM = "其他"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "651") { outpatient_dr_detail.FYLBBM = "病史复印费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "652") { outpatient_dr_detail.FYLBBM = "健康检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "653") { outpatient_dr_detail.FYLBBM = "工本费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "654") { outpatient_dr_detail.FYLBBM = "磁卡费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "655") { outpatient_dr_detail.FYLBBM = "中草药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "656") { outpatient_dr_detail.FYLBBM = "护理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "657") { outpatient_dr_detail.FYLBBM = "孕产期检查"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "658") { outpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "659") { outpatient_dr_detail.FYLBBM = "孕产期检验"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "660") { outpatient_dr_detail.FYLBBM = "西药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "661") { outpatient_dr_detail.FYLBBM = "中成药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "662") { outpatient_dr_detail.FYLBBM = "化验费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "663") { outpatient_dr_detail.FYLBBM = "孕产期检验"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "664") { outpatient_dr_detail.FYLBBM = "治疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "665") { outpatient_dr_detail.FYLBBM = "医用材料费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "666") { outpatient_dr_detail.FYLBBM = "摄片费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "667") { outpatient_dr_detail.FYLBBM = "CT费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "668") { outpatient_dr_detail.FYLBBM = "检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "669") { outpatient_dr_detail.FYLBBM = "孕产期检查"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "670") { outpatient_dr_detail.FYLBBM = "核磁共振"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "671") { outpatient_dr_detail.FYLBBM = "输氧费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "672") { outpatient_dr_detail.FYLBBM = "输血费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "673") { outpatient_dr_detail.FYLBBM = "抢救费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "674") { outpatient_dr_detail.FYLBBM = "证书费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "675") { outpatient_dr_detail.FYLBBM = "饮食费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "676") { outpatient_dr_detail.FYLBBM = "病理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "677") { outpatient_dr_detail.FYLBBM = "住院费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "678") { outpatient_dr_detail.FYLBBM = "诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "679") { outpatient_dr_detail.FYLBBM = "三级医院诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "680") { outpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "681") { outpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "682") { outpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "683") { outpatient_dr_detail.FYLBBM = "点名高级专家诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "684") { outpatient_dr_detail.FYLBBM = "著名专家诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "685") { outpatient_dr_detail.FYLBBM = "空号"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "686") { outpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "687") { outpatient_dr_detail.FYLBBM = "手术费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "688") { outpatient_dr_detail.FYLBBM = "透视费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "689") { outpatient_dr_detail.FYLBBM = "出诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "690") { outpatient_dr_detail.FYLBBM = "留观费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "691") { outpatient_dr_detail.FYLBBM = "其他"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "692") { outpatient_dr_detail.FYLBBM = "病史复印费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "693") { outpatient_dr_detail.FYLBBM = "健康检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "694") { outpatient_dr_detail.FYLBBM = "工本费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "695") { outpatient_dr_detail.FYLBBM = "磁卡费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "696") { outpatient_dr_detail.FYLBBM = "中草药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "697") { outpatient_dr_detail.FYLBBM = "护理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "698") { outpatient_dr_detail.FYLBBM = "会诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "699") { outpatient_dr_detail.FYLBBM = "西药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "700") { outpatient_dr_detail.FYLBBM = "中成药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "701") { outpatient_dr_detail.FYLBBM = "化验费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "702") { outpatient_dr_detail.FYLBBM = "孕产期检验"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "703") { outpatient_dr_detail.FYLBBM = "治疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "704") { outpatient_dr_detail.FYLBBM = "医用材料费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "705") { outpatient_dr_detail.FYLBBM = "摄片费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "706") { outpatient_dr_detail.FYLBBM = "CT费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "707") { outpatient_dr_detail.FYLBBM = "检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "708") { outpatient_dr_detail.FYLBBM = "孕产期检查"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "709") { outpatient_dr_detail.FYLBBM = "核磁共振"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "710") { outpatient_dr_detail.FYLBBM = "输氧费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "711") { outpatient_dr_detail.FYLBBM = "输血费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "712") { outpatient_dr_detail.FYLBBM = "抢救费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "713") { outpatient_dr_detail.FYLBBM = "证书费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "714") { outpatient_dr_detail.FYLBBM = "饮食费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "715") { outpatient_dr_detail.FYLBBM = "病理费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "716") { outpatient_dr_detail.FYLBBM = "住院费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "717") { outpatient_dr_detail.FYLBBM = "诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "718") { outpatient_dr_detail.FYLBBM = "三级医院诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "719") { outpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "720") { outpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "721") { outpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "722") { outpatient_dr_detail.FYLBBM = "点名专家1诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "723") { outpatient_dr_detail.FYLBBM = "点名专家2诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "724") { outpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "725") { outpatient_dr_detail.FYLBBM = "手术费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "726") { outpatient_dr_detail.FYLBBM = "透视费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "727") { outpatient_dr_detail.FYLBBM = "出诊费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "728") { outpatient_dr_detail.FYLBBM = "留观费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "729") { outpatient_dr_detail.FYLBBM = "其他"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "730") { outpatient_dr_detail.FYLBBM = "病史复印费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "731") { outpatient_dr_detail.FYLBBM = "健康检查费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "732") { outpatient_dr_detail.FYLBBM = "工本费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "733") { outpatient_dr_detail.FYLBBM = "磁卡费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "734") { outpatient_dr_detail.FYLBBM = "中草药费"; }
                    else if (dta.Rows[i]["c_int_038"].ToString() == "735") { outpatient_dr_detail.FYLBBM = "护理费"; }
                    #endregion

                    #region 零售价
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_003"]))
                    {
                        outpatient_dr_detail.LSJ = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.LSJ = Convert.ToDecimal(dta.Rows[i]["c_float_003"]);
                    }
                    #endregion

                    #region 自费价
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_005"]))
                    {
                        outpatient_dr_detail.ZFJ = 000;
                    }
                    else
                    {
                        outpatient_dr_detail.ZFJ = Convert.ToDecimal(dta.Rows[i]["c_float_005"]);
                    }
                    #endregion

                    #region 医嘱下达时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_005"]))
                    {
                        outpatient_dr_detail.YZXDSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        outpatient_dr_detail.YZXDSJ = Convert.ToDateTime(dta.Rows[i]["c_date_005"]);
                    }
                    #endregion

                    #region 医嘱执行时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_002"]))
                    {
                        outpatient_dr_detail.YZZXSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        outpatient_dr_detail.YZZXSJ = Convert.ToDateTime(dta.Rows[i]["c_date_002"]);
                    }
                    #endregion

                    #region 医嘱取消时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_003"]))
                    {
                        outpatient_dr_detail.YZQXSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        outpatient_dr_detail.YZQXSJ = Convert.ToDateTime(dta.Rows[i]["c_date_003"]);
                    }
                    #endregion

                    #region 医嘱终止时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        outpatient_dr_detail.YZZZSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        outpatient_dr_detail.YZZZSJ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion

                    #region 创建时间
                    outpatient_dr_detail.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    #endregion

                    #region 其他
                    outpatient_dr_detail.XGBZ = 0;
                    outpatient_dr_detail.YLYL1 = null;
                    outpatient_dr_detail.YLYL2 = null;
                    #endregion

                    list.Add(outpatient_dr_detail);
                    #endregion

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                }

                access.InsertList(list,bar);
                list.Clear();
                dta.Clear();
                //MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }

        /// <summary>
        /// 从GetDB的DataTable将住院医嘱明细表存入数据库
        /// </summary>
        public void Inpatient_DrAdvice_Detail_TransByDB()
        {
            Inpatient_DrAdvice_DetailAccess access = new Inpatient_DrAdvice_DetailAccess();
            List<Inpatient_DrAdvice_Detail> list = new List<Inpatient_DrAdvice_Detail>();
            

            GetDB getdb = new GetDB();                              //调用GetDB类
            DataTable dta = new DataTable();                          //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-06-22 10:25:41");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Inpatient_DrAdvice_Detail"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);       //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            int point_time_num;      //开始时间点的数据数
            int step_time_num;           //要取时间段的数据数

            //bar.Show();                  //初始化进度条

            for (int j = 0; j < 20; j++)   //取3天的数据
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getInpatient_DrAdvice_Detail_DataTable(create_time, access);

                point_time_num = Num.GetCount2("Inpatient_DrAdvice_Detail", create_time);
                step_time_num = dta.Rows.Count;


                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    //MessageBox.Show("从" + create_time.ToString() + "到" + end_time.ToString() + "，没有数据");
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getInpatient_DrAdvice_Detail_DataTable(create_time, access);
                    //   point_time_num = Num.GetCount2("Outpatient_DrAdvice_Detail", create_time);
                    step_time_num = dta.Rows.Count;
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Inpatient_DrAdvice_Detail inpatient_dr_detail = new Inpatient_DrAdvice_Detail();
                    #region 表属性填充

                    #region 医疗机构代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_020"]))
                    {
                        inpatient_dr_detail.YLJGDM = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YLJGDM = dta.Rows[i]["c_str_020"].ToString();
                    }
                    #endregion

                    #region 医嘱序号
                    inpatient_dr_detail.YZXH = Convert.ToInt32(dta.Rows[i]["c_int_040"]);
                    #endregion

                    #region 就诊流水号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_036"]))
                    {
                        inpatient_dr_detail.JZLSH = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_036"]);
                    }
                    #endregion

                    #region 病人ID
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_006"]))
                    {
                        inpatient_dr_detail.PatientID = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_006"]);
                    }
                    #endregion

                    #region 卡号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_019"]))
                    {
                        inpatient_dr_detail.KH = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.KH = dta.Rows[i]["c_str_019"].ToString();
                    }
                    #endregion

                    #region 医嘱状态
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        inpatient_dr_detail.YZZT = "不明";
                    }
                    else
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_000"]))
                        {
                            case 1: inpatient_dr_detail.YZZT = "待审"; break;
                            case 2: inpatient_dr_detail.YZZT = "审核"; break;
                            case 3: inpatient_dr_detail.YZZT = "执行"; break;
                            case 4: inpatient_dr_detail.YZZT = "收费"; break;
                            case 5: inpatient_dr_detail.YZZT = "取消"; break;
                            case 6: inpatient_dr_detail.YZZT = "停止"; break;

                            default: inpatient_dr_detail.YPYF = "不明"; break;
                        }

                    }
          #endregion

                    #region 长期医嘱标志
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_014"]))
                    {
                        inpatient_dr_detail.CQYZBZ = "不明";
                    }
                    else if (dta.Rows[i]["c_int_014"].ToString() == "0")
                    {
                        inpatient_dr_detail.CQYZBZ = "否";
                    }
                    else if (dta.Rows[i]["c_int_014"].ToString() == "1")
                    {
                        inpatient_dr_detail.CQYZBZ = "是";
                    }
                    #endregion

                    #region 医嘱类型编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_025"]))
                    {
                        inpatient_dr_detail.YZLXBM = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZLXBM = dta.Rows[i]["c_str_025"].ToString();
                    }
                    #endregion

                    #region 医嘱类别
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_007"]))
                    {
                        inpatient_dr_detail.YZLB = "不明";
                    }
                    else
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_007"]))
                        {
                            case 0: inpatient_dr_detail.YZLB = "药品"; break;
                            case 1: inpatient_dr_detail.YZLB = "治疗"; break;
                            case 2: inpatient_dr_detail.YZLB = "手术"; break;
                            case 3: inpatient_dr_detail.YZLB = "麻醉"; break;
                            case 4: inpatient_dr_detail.YZLB = "膳食"; break;
                            case 5: inpatient_dr_detail.YZLB = "输血"; break;
                            case 6: inpatient_dr_detail.YZLB = "护理"; break;
                            case 7: inpatient_dr_detail.YZLB = "床位"; break;
                            case 8: inpatient_dr_detail.YZLB = "检查"; break;
                            case 9: inpatient_dr_detail.YZLB = "检验"; break;
                            case 10: inpatient_dr_detail.YZLB = "输液"; break;
                            case 11: inpatient_dr_detail.YZLB = "材料"; break;
                            case 12: inpatient_dr_detail.YZLB = "转科"; break;
                            case 13: inpatient_dr_detail.YZLB = "转床"; break;
                            case 14: inpatient_dr_detail.YZLB = "出院"; break;
                            case 15: inpatient_dr_detail.YZLB = "出院带药"; break;
                            case 16: inpatient_dr_detail.YZLB = "其他"; break;
                            default: inpatient_dr_detail.YZLB = "不明";break;
                        }
                    }    
                  #endregion

                    #region 医嘱组号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_016"]))
                    {
                        inpatient_dr_detail.YZZH = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.YZZH = Convert.ToInt32(dta.Rows[i]["c_int_016"]);
                    }
                    #endregion

                    #region 医嘱说明
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_034"]))
                    {
                        inpatient_dr_detail.YZSM = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZSM = dta.Rows[i]["c_str_034"].ToString();
                    }
                    #endregion

                    #region 病区代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_027"]))
                    {
                        inpatient_dr_detail.BQDM = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.BQDM = Convert.ToInt32(dta.Rows[i]["c_int_027"]);
                    }
                    #endregion

                    #region 病区名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_009"]))
                    {
                        inpatient_dr_detail.BQMC = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.BQMC = dta.Rows[i]["c_str_009"].ToString();
                    }
                    #endregion

                    #region 科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_025"]))
                    {
                        inpatient_dr_detail.KSBM = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.KSBM = Convert.ToInt32(dta.Rows[i]["c_int_025"]);
                    }
                    #endregion

                    #region 科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        inpatient_dr_detail.KSMC = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.KSMC = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 医嘱下达科室
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_022"]))
                    {
                        inpatient_dr_detail.YZXDKS = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZXDKS = dta.Rows[i]["c_str_022"].ToString();
                    }
                    #endregion

                    #region 医嘱执行科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_017"]))
                    {
                        inpatient_dr_detail.YZZXKSBM = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.YZZXKSBM = Convert.ToInt32(dta.Rows[i]["c_int_017"]);
                    }
                    #endregion

                    #region 医嘱执行科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_006"]))
                    {
                        inpatient_dr_detail.YZZXKSMC = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZZXKSMC = dta.Rows[i]["c_str_006"].ToString();
                    }
                    #endregion

                    #region 下达人工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_008"]))
                    {
                        inpatient_dr_detail.XDRGH = 00000000;
                    }
                    else
                    {
                        inpatient_dr_detail.XDRGH = Convert.ToInt32(dta.Rows[i]["c_int_008"]);
                    }
                    #endregion

                    #region 下达人姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        inpatient_dr_detail.XDRXM = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.XDRXM = dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 执行人工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_023"]))
                    {
                        inpatient_dr_detail.ZXRGH = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.ZXRGH = Convert.ToInt32(dta.Rows[i]["c_str_023"]);
                    }
                    #endregion

                    #region 执行人姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_024"]))
                    {
                        inpatient_dr_detail.ZXRXM = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.ZXRXM = dta.Rows[i]["c_str_024"].ToString();
                    }
                    #endregion

                    #region 医嘱停止医生工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_018"]))
                    {
                        inpatient_dr_detail.YZTZYSGH = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.YZTZYSGH = Convert.ToInt32(dta.Rows[i]["c_int_018"]);
                    }
                    #endregion

                    #region 医嘱明细编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_023"]))
                    {
                        inpatient_dr_detail.YZMXBM = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.YZMXBM = Convert.ToInt32(dta.Rows[i]["c_int_023"]);
                    }
                    #endregion

                    #region 医嘱明细名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        inpatient_dr_detail.YZMXMC = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZMXMC = dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 医保药品编码
                    if (Convert.IsDBNull(Convert.IsDBNull(dta.Rows[i]["c_str_041"])))
                    {
                        inpatient_dr_detail.YBYPBM = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YBYPBM = dta.Rows[i]["c_str_041"].ToString();
                    }
                    #endregion

                    #region 数量
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_002"]))
                    {
                        inpatient_dr_detail.SL = 0;
                    }
                    else
                    {
                        inpatient_dr_detail.SL = Convert.ToDecimal(dta.Rows[i]["c_float_002"]);
                    }
                    #endregion

                    #region 医嘱领取最小单位
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_005"]))
                    {
                        inpatient_dr_detail.YZLQZXDW = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZLQZXDW = dta.Rows[i]["c_str_005"].ToString();
                    }
                    #endregion

                    #region 药品规格
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_008"]))
                    {
                        inpatient_dr_detail.YPGG = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YPGG = dta.Rows[i]["c_str_008"].ToString();
                    }
                    #endregion

                    #region 剂量系数
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_001"]))
                    {
                        inpatient_dr_detail.JLXS = 0;
                    }
                    else
                    {
                        inpatient_dr_detail.JLXS = Convert.ToDecimal(dta.Rows[i]["c_float_001"]);
                    }
                    #endregion

                    #region 发药剂量
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_028"]))
                    {
                        inpatient_dr_detail.FYJL = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.FYJL = dta.Rows[i]["c_str_028"].ToString();
                    }
                    #endregion

                    #region 用药剂量
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_009"]))
                    {
                        inpatient_dr_detail.YYJL = 0;
                    }
                    else
                    {
                        inpatient_dr_detail.YYJL = Convert.ToDecimal(dta.Rows[i]["c_float_009"]);
                    }
                    #endregion

                    #region 剂量单位
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_037"]))
                    {
                        inpatient_dr_detail.JLDW = "不明";
                    }
                    else
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_037"]))
                        {
                            case 2: inpatient_dr_detail.JLDW = "10盒"; break;
                            case 3: inpatient_dr_detail.JLDW = "AMP"; break;
                            case 4: inpatient_dr_detail.JLDW = "APM"; break;
                            case 5: inpatient_dr_detail.JLDW = "AU"; break;
                            case 6: inpatient_dr_detail.JLDW = "B"; break;
                            case 7: inpatient_dr_detail.JLDW = "BAB"; break;
                            case 8: inpatient_dr_detail.JLDW = "BAG"; break;
                            case 9: inpatient_dr_detail.JLDW = "BAT"; break;
                            case 10: inpatient_dr_detail.JLDW = "BOA"; break;
                            case 11: inpatient_dr_detail.JLDW = "BOG"; break;
                            case 12: inpatient_dr_detail.JLDW = "BOT"; break;
                            case 13: inpatient_dr_detail.JLDW = "BOX"; break;
                            case 14: inpatient_dr_detail.JLDW = "BTO"; break;
                            case 15: inpatient_dr_detail.JLDW = "bu"; break;
                            case 16: inpatient_dr_detail.JLDW = "c"; break;
                            case 17: inpatient_dr_detail.JLDW = "CAN"; break;
                            case 18: inpatient_dr_detail.JLDW = "cm2"; break;
                            case 19: inpatient_dr_detail.JLDW = "CO"; break;
                            case 20: inpatient_dr_detail.JLDW = "DOT"; break;
                            case 21: inpatient_dr_detail.JLDW = "DROP"; break;
                            case 22: inpatient_dr_detail.JLDW = "EPU"; break;
                            case 23: inpatient_dr_detail.JLDW = "g"; break;
                            case 24: inpatient_dr_detail.JLDW = "G"; break;
                            case 25: inpatient_dr_detail.JLDW = "g/ml"; break;
                            case 26: inpatient_dr_detail.JLDW = "iu"; break;
                            case 27: inpatient_dr_detail.JLDW = "IU"; break;
                            case 28: inpatient_dr_detail.JLDW = "kg"; break;
                            case 29: inpatient_dr_detail.JLDW = "KU"; break;
                            case 30: inpatient_dr_detail.JLDW = "L"; break;
                            case 31: inpatient_dr_detail.JLDW = "Lsu"; break;
                            case 32: inpatient_dr_detail.JLDW = "M"; break;
                            case 33: inpatient_dr_detail.JLDW = "mci"; break;
                            case 34: inpatient_dr_detail.JLDW = "mg"; break;
                            case 35: inpatient_dr_detail.JLDW = "MG"; break;
                            case 36: inpatient_dr_detail.JLDW = "MISC"; break;
                            case 37: inpatient_dr_detail.JLDW = "miu"; break;
                            case 38: inpatient_dr_detail.JLDW = "ml"; break;
                            case 39: inpatient_dr_detail.JLDW = "ML"; break;
                            case 40: inpatient_dr_detail.JLDW = "NOX"; break;
                            case 41: inpatient_dr_detail.JLDW = "NULL"; break;
                            case 42: inpatient_dr_detail.JLDW = "OINT"; break;
                            case 43: inpatient_dr_detail.JLDW = "PE"; break;
                            case 44: inpatient_dr_detail.JLDW = "SING"; break;
                            case 45: inpatient_dr_detail.JLDW = "SOLN"; break;
                            case 46: inpatient_dr_detail.JLDW = "SPRA"; break;
                            case 47: inpatient_dr_detail.JLDW = "T"; break;
                            case 48: inpatient_dr_detail.JLDW = "TAB"; break;
                            case 49: inpatient_dr_detail.JLDW = "TOX"; break;
                            case 50: inpatient_dr_detail.JLDW = "TUBE"; break;
                            case 51: inpatient_dr_detail.JLDW = "TUBM"; break;
                            case 52: inpatient_dr_detail.JLDW = "TUMB"; break;
                            case 53: inpatient_dr_detail.JLDW = "TUNE"; break;
                            case 54: inpatient_dr_detail.JLDW = "U"; break;
                            case 55: inpatient_dr_detail.JLDW = "u"; break;
                            case 56: inpatient_dr_detail.JLDW = "ug"; break;
                            case 57: inpatient_dr_detail.JLDW = "UG"; break;
                            case 58: inpatient_dr_detail.JLDW = "VAIL"; break;
                            case 59: inpatient_dr_detail.JLDW = "VIAL"; break;
                            case 60: inpatient_dr_detail.JLDW = "VILN"; break;
                            case 61: inpatient_dr_detail.JLDW = "XX"; break;
                            case 62: inpatient_dr_detail.JLDW = "YUBE"; break;
                            case 63: inpatient_dr_detail.JLDW = "安瓿"; break;
                            case 64: inpatient_dr_detail.JLDW = "百万"; break;
                            case 65: inpatient_dr_detail.JLDW = "板"; break;
                            case 66: inpatient_dr_detail.JLDW = "包"; break;
                            case 67: inpatient_dr_detail.JLDW = "本"; break;
                            case 68: inpatient_dr_detail.JLDW = "次"; break;
                            case 69: inpatient_dr_detail.JLDW = "大袋"; break;
                            case 70: inpatient_dr_detail.JLDW = "大盒"; break;
                            case 71: inpatient_dr_detail.JLDW = "大扎"; break;
                            case 72: inpatient_dr_detail.JLDW = "代"; break;
                            case 73: inpatient_dr_detail.JLDW = "袋"; break;
                            case 75: inpatient_dr_detail.JLDW = "单位"; break;
                            case 76: inpatient_dr_detail.JLDW = "滴瓶"; break;
                            case 77: inpatient_dr_detail.JLDW = "对"; break;
                            case 78: inpatient_dr_detail.JLDW = "份"; break;
                            case 79: inpatient_dr_detail.JLDW = "格"; break;
                            case 80: inpatient_dr_detail.JLDW = "个"; break;
                            case 81: inpatient_dr_detail.JLDW = "管"; break;
                            case 82: inpatient_dr_detail.JLDW = "罐"; break;
                            case 83: inpatient_dr_detail.JLDW = "罐桶"; break;
                            case 84: inpatient_dr_detail.JLDW = "广口"; break;
                            case 85: inpatient_dr_detail.JLDW = "国际"; break;
                            case 86: inpatient_dr_detail.JLDW = "含片"; break;
                            case 87: inpatient_dr_detail.JLDW = "毫升"; break;
                            case 88: inpatient_dr_detail.JLDW = "盒"; break;
                            case 89: inpatient_dr_detail.JLDW = "剂"; break;
                            case 90: inpatient_dr_detail.JLDW = "胶囊"; break;
                            case 92: inpatient_dr_detail.JLDW = "克"; break;
                            case 93: inpatient_dr_detail.JLDW = "块"; break;
                            case 94: inpatient_dr_detail.JLDW = "粒"; break;
                            case 95: inpatient_dr_detail.JLDW = "枚"; break;
                            case 96: inpatient_dr_detail.JLDW = "排"; break;
                            case 97: inpatient_dr_detail.JLDW = "喷"; break;
                            case 98: inpatient_dr_detail.JLDW = "批"; break;
                            case 99: inpatient_dr_detail.JLDW = "片"; break;
                            case 100: inpatient_dr_detail.JLDW = "瓶"; break;
                            case 101: inpatient_dr_detail.JLDW = "其它"; break;
                            case 102: inpatient_dr_detail.JLDW = "千张"; break;
                            case 103: inpatient_dr_detail.JLDW = "揿"; break;
                            case 104: inpatient_dr_detail.JLDW = "十亿"; break;
                            case 105: inpatient_dr_detail.JLDW = "拴"; break;
                            case 106: inpatient_dr_detail.JLDW = "塑瓶"; break;
                            case 107: inpatient_dr_detail.JLDW = "套"; break;
                            case 108: inpatient_dr_detail.JLDW = "条"; break;
                            case 109: inpatient_dr_detail.JLDW = "贴"; break;
                            case 110: inpatient_dr_detail.JLDW = "桶"; break;
                            case 111: inpatient_dr_detail.JLDW = "筒"; break;
                            case 112: inpatient_dr_detail.JLDW = "透皮"; break;
                            case 113: inpatient_dr_detail.JLDW = "丸"; break;
                            case 114: inpatient_dr_detail.JLDW = "万"; break;
                            case 115: inpatient_dr_detail.JLDW = "万iu"; break;
                            case 116: inpatient_dr_detail.JLDW = "万U"; break;
                            case 117: inpatient_dr_detail.JLDW = "万片"; break;
                            case 118: inpatient_dr_detail.JLDW = "万套"; break;
                            case 119: inpatient_dr_detail.JLDW = "微克"; break;
                            case 120: inpatient_dr_detail.JLDW = "微升"; break;
                            case 121: inpatient_dr_detail.JLDW = "西林"; break;
                            case 122: inpatient_dr_detail.JLDW = "吸"; break;
                            case 123: inpatient_dr_detail.JLDW = "锡管"; break;
                            case 124: inpatient_dr_detail.JLDW = "匣"; break;
                            case 125: inpatient_dr_detail.JLDW = "箱"; break;
                            case 126: inpatient_dr_detail.JLDW = "小袋"; break;
                            case 127: inpatient_dr_detail.JLDW = "小盒"; break;
                            case 128: inpatient_dr_detail.JLDW = "小扎"; break;
                            case 129: inpatient_dr_detail.JLDW = "药条"; break;
                            case 130: inpatient_dr_detail.JLDW = "杂类"; break;
                            case 131: inpatient_dr_detail.JLDW = "张"; break;
                            case 132: inpatient_dr_detail.JLDW = "支"; break;
                            case 133: inpatient_dr_detail.JLDW = "中盒"; break;
                            case 134: inpatient_dr_detail.JLDW = "co"; break;
                            case 135: inpatient_dr_detail.JLDW = "s"; break;
                            case 136: inpatient_dr_detail.JLDW = "万IU"; break;
                            case 137: inpatient_dr_detail.JLDW = "BU"; break;
                            case 138: inpatient_dr_detail.JLDW = "Co"; break;
                            case 139: inpatient_dr_detail.JLDW = "百万iu"; break;
                            case 140: inpatient_dr_detail.JLDW = "KIU"; break;
                            case 141: inpatient_dr_detail.JLDW = "天"; break;
                            case 142: inpatient_dr_detail.JLDW = "只"; break;
                            case 143: inpatient_dr_detail.JLDW = "副"; break;
                            case 144: inpatient_dr_detail.JLDW = "根"; break;
                            case 145: inpatient_dr_detail.JLDW = "双"; break;
                            case 146: inpatient_dr_detail.JLDW = "小时"; break;
                            case 147: inpatient_dr_detail.JLDW = "件"; break;
                            case 148: inpatient_dr_detail.JLDW = "oD"; break;
                            case 149: inpatient_dr_detail.JLDW = "?§"; break;
                            case 150: inpatient_dr_detail.JLDW = "??"; break;
                            case 151: inpatient_dr_detail.JLDW = "°ü"; break;
                            case 152: inpatient_dr_detail.JLDW = "10oD"; break;
                            case 153: inpatient_dr_detail.JLDW = "box"; break;
                            case 154: inpatient_dr_detail.JLDW = "′ü"; break;
                            case 155: inpatient_dr_detail.JLDW = "°?"; break;
                            case 156: inpatient_dr_detail.JLDW = "??"; break;
                            case 157: inpatient_dr_detail.JLDW = "amp"; break;
                            case 158: inpatient_dr_detail.JLDW = "á￡"; break;
                            case 159: inpatient_dr_detail.JLDW = "bot"; break;
                            case 160: inpatient_dr_detail.JLDW = "?DoD"; break;
                            case 161: inpatient_dr_detail.JLDW = "bag"; break;
                            case 162: inpatient_dr_detail.JLDW = "′ú"; break;
                            case 163: inpatient_dr_detail.JLDW = "vial"; break;
                            case 164: inpatient_dr_detail.JLDW = "μ￥??"; break;
                            case 165: inpatient_dr_detail.JLDW = "ìù"; break;
                            case 166: inpatient_dr_detail.JLDW = "ì?"; break;
                            case 167: inpatient_dr_detail.JLDW = "Tì"; break;
                            case 168: inpatient_dr_detail.JLDW = "?ü??"; break;
                            case 169: inpatient_dr_detail.JLDW = "ì×"; break;
                            case 170: inpatient_dr_detail.JLDW = "í°"; break;
                            case 171: inpatient_dr_detail.JLDW = "%"; break;
                            case 172: inpatient_dr_detail.JLDW = "1"; break;
                            case 173: inpatient_dr_detail.JLDW = "."; break;
                            case 174: inpatient_dr_detail.JLDW = "100t"; break;
                            case 175: inpatient_dr_detail.JLDW = "2t"; break;
                            case 176: inpatient_dr_detail.JLDW = "'\'"; break;
                            case 177: inpatient_dr_detail.JLDW = "6u"; break;
                            case 178: inpatient_dr_detail.JLDW = "帖"; break;
                            case 179: inpatient_dr_detail.JLDW = "中板"; break;
                            case 180: inpatient_dr_detail.JLDW = "例"; break;
                            case 181: inpatient_dr_detail.JLDW = "单侧"; break;
                            case 182: inpatient_dr_detail.JLDW = "q8h"; break;
                            case 183: inpatient_dr_detail.JLDW = "1.5M"; break;
                            case 184: inpatient_dr_detail.JLDW = "把"; break;
                            case 185: inpatient_dr_detail.JLDW = "公斤"; break;
                            case 186: inpatient_dr_detail.JLDW = "付"; break;
                            case 187: inpatient_dr_detail.JLDW = "卷"; break;
                            default: inpatient_dr_detail.JLDW = "不明"; break;
                        }
                    }
                    #endregion

                    #region 药品用法
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_003"]))
                    {
                        inpatient_dr_detail.YPYF = "不明";
                    }
                    else
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_003"]))
                        {
                            case 1: inpatient_dr_detail.YPYF = "口服"; break;
                            case 2: inpatient_dr_detail.YPYF = "含服"; break;
                            case 3: inpatient_dr_detail.YPYF = "顿服"; break;
                            case 4: inpatient_dr_detail.YPYF = "吞下"; break;
                            case 5: inpatient_dr_detail.YPYF = "外用"; break;
                            case 6: inpatient_dr_detail.YPYF = "研粉"; break;
                            case 7: inpatient_dr_detail.YPYF = "胃注"; break;
                            case 8: inpatient_dr_detail.YPYF = "漱口"; break;
                            case 9: inpatient_dr_detail.YPYF = "冲管"; break;
                            case 10: inpatient_dr_detail.YPYF = "肌肉注射"; break;
                            case 11: inpatient_dr_detail.YPYF = "肌注化疗"; break;
                            case 12: inpatient_dr_detail.YPYF = "皮下注射"; break;
                            case 13: inpatient_dr_detail.YPYF = "喷雾"; break;
                            case 14: inpatient_dr_detail.YPYF = "鼻饲"; break;
                            case 15: inpatient_dr_detail.YPYF = "外敷"; break;
                            case 16: inpatient_dr_detail.YPYF = "外涂"; break;
                            case 17: inpatient_dr_detail.YPYF = "冲服"; break;
                            case 18: inpatient_dr_detail.YPYF = "静脉推注"; break;
                            case 19: inpatient_dr_detail.YPYF = "静脉注射化疗"; break;
                            case 20: inpatient_dr_detail.YPYF = "营养"; break;
                            case 21: inpatient_dr_detail.YPYF = "局麻"; break;
                            case 22: inpatient_dr_detail.YPYF = "静脉滴注"; break;
                            case 23: inpatient_dr_detail.YPYF = "含漱"; break;
                            case 24: inpatient_dr_detail.YPYF = "球周注射"; break;
                            case 25: inpatient_dr_detail.YPYF = "清洗"; break;
                            case 26: inpatient_dr_detail.YPYF = "涂眼"; break;
                            case 27: inpatient_dr_detail.YPYF = "造影"; break;
                            case 28: inpatient_dr_detail.YPYF = "皮试"; break;
                            case 29: inpatient_dr_detail.YPYF = "皮内注射"; break;
                            case 30: inpatient_dr_detail.YPYF = "青霉素皮试"; break;
                            case 31: inpatient_dr_detail.YPYF = "PDP皮试"; break;
                            case 32: inpatient_dr_detail.YPYF = "局部封闭"; break;
                            case 33: inpatient_dr_detail.YPYF = "局部浸润麻醉"; break;
                            case 34: inpatient_dr_detail.YPYF = "自注"; break;
                            case 35: inpatient_dr_detail.YPYF = "喷喉"; break;
                            case 36: inpatient_dr_detail.YPYF = "喷鼻"; break;
                            case 37: inpatient_dr_detail.YPYF = "滴鼻"; break;
                            case 38: inpatient_dr_detail.YPYF = "阴道用"; break;
                            case 39: inpatient_dr_detail.YPYF = "肛门用"; break;
                            case 40: inpatient_dr_detail.YPYF = "尿道用"; break;
                            case 41: inpatient_dr_detail.YPYF = "灌肠用"; break;
                            case 42: inpatient_dr_detail.YPYF = "搽患处"; break;
                            case 43: inpatient_dr_detail.YPYF = "敷用"; break;
                            case 44: inpatient_dr_detail.YPYF = "滴眼"; break;
                            case 45: inpatient_dr_detail.YPYF = "滴耳"; break;
                            case 46: inpatient_dr_detail.YPYF = "舌下含服"; break;
                            case 47: inpatient_dr_detail.YPYF = "心内注射"; break;
                            case 48: inpatient_dr_detail.YPYF = "动脉加压注射"; break;
                            case 49: inpatient_dr_detail.YPYF = "皮下输液"; break;
                            case 50: inpatient_dr_detail.YPYF = "肛内用"; break;
                            case 51: inpatient_dr_detail.YPYF = "小儿静脉输注"; break;
                            case 52: inpatient_dr_detail.YPYF = "穴位注射"; break;
                            case 53: inpatient_dr_detail.YPYF = "酒精擦浴"; break;
                            case 54: inpatient_dr_detail.YPYF = "雾化吸入"; break;
                            case 55: inpatient_dr_detail.YPYF = "气泵吸入"; break;
                            case 56: inpatient_dr_detail.YPYF = "坐浴"; break;
                            case 57: inpatient_dr_detail.YPYF = "推拿"; break;
                            case 58: inpatient_dr_detail.YPYF = "宫底注射"; break;
                            case 59: inpatient_dr_detail.YPYF = "宫颈注射"; break;
                            case 60: inpatient_dr_detail.YPYF = "煎服"; break;
                            case 61: inpatient_dr_detail.YPYF = "其他"; break;
                            case 62: inpatient_dr_detail.YPYF = "BID"; break;
                            case 63: inpatient_dr_detail.YPYF = "CX"; break;
                            case 64: inpatient_dr_detail.YPYF = "DY"; break;
                            case 65: inpatient_dr_detail.YPYF = "GTT"; break;
                            case 66: inpatient_dr_detail.YPYF = "ID"; break;
                            case 67: inpatient_dr_detail.YPYF = "IH"; break;
                            case 68: inpatient_dr_detail.YPYF = "IM"; break;
                            case 69: inpatient_dr_detail.YPYF = "IV"; break;
                            case 70: inpatient_dr_detail.YPYF = "IVG"; break;
                            case 71: inpatient_dr_detail.YPYF = "IVGTT"; break;
                            case 72: inpatient_dr_detail.YPYF = "NG"; break;
                            case 73: inpatient_dr_detail.YPYF = "P.O"; break;
                            case 74: inpatient_dr_detail.YPYF = "QD"; break;
                            case 75: inpatient_dr_detail.YPYF = "qd1"; break;
                            case 76: inpatient_dr_detail.YPYF = "QN"; break;
                            case 77: inpatient_dr_detail.YPYF = "SK"; break;
                            case 78: inpatient_dr_detail.YPYF = "SX"; break;
                            case 79: inpatient_dr_detail.YPYF = "TID"; break;
                            case 80: inpatient_dr_detail.YPYF = "WH"; break;
                            case 81: inpatient_dr_detail.YPYF = "ZL"; break;
                            case 82: inpatient_dr_detail.YPYF = "吸入"; break;
                            case 83: inpatient_dr_detail.YPYF = "肌注"; break;
                            case 84: inpatient_dr_detail.YPYF = "静注"; break;
                            case 85: inpatient_dr_detail.YPYF = "静滴"; break;
                            case 86: inpatient_dr_detail.YPYF = "皮下"; break;
                            case 87: inpatient_dr_detail.YPYF = "皮内"; break;
                            case 88: inpatient_dr_detail.YPYF = "滴左眼"; break;
                            case 89: inpatient_dr_detail.YPYF = "滴右眼"; break;
                            case 90: inpatient_dr_detail.YPYF = "洗胃"; break;
                            case 91: inpatient_dr_detail.YPYF = "洗耳"; break;
                            case 92: inpatient_dr_detail.YPYF = "纳肛"; break;
                            case 93: inpatient_dr_detail.YPYF = "灌肠"; break;
                            case 94: inpatient_dr_detail.YPYF = "纳阴"; break;
                            case 95: inpatient_dr_detail.YPYF = "膀胱冲洗"; break;
                            case 96: inpatient_dr_detail.YPYF = "阴道冲洗剂"; break;
                            case 97: inpatient_dr_detail.YPYF = "1汤匙"; break;
                            case 98: inpatient_dr_detail.YPYF = "关节内注射"; break;
                            case 99: inpatient_dr_detail.YPYF = "神经阻滞"; break;
                            case 100: inpatient_dr_detail.YPYF = "睡前涂眼"; break;
                            case 101: inpatient_dr_detail.YPYF = "骶管阻滞"; break;
                            case 102: inpatient_dr_detail.YPYF = "TIW"; break;

                            default: inpatient_dr_detail.YPYF = "不明"; break;
                        }
                    }

                #endregion

                    #region 用药频度
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_032"]))
                    {
                        inpatient_dr_detail.YYPD = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YYPD = dta.Rows[i]["c_str_032"].ToString();
                    }
                    #endregion

                    #region 医嘱频次编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_024"]))
                    {
                        inpatient_dr_detail.YZPCBM = 000;
                    }
                    else
                    {
                        inpatient_dr_detail.YZPCBM = Convert.ToInt32(dta.Rows[i]["c_int_024"]);
                    }
                    #endregion

                    #region 医嘱频次名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        inpatient_dr_detail.YZPCMC = "不明";
                    }
                    else
                    {
                        inpatient_dr_detail.YZPCMC = dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion

                    #region 费用类别编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_038"]))
                    {
                        inpatient_dr_detail.FYLBBM = "不明";
                    }
                    else
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_038"]))
                        {
                            case 474: inpatient_dr_detail.FYLBBM = "会诊费"; break;
                            case 475: inpatient_dr_detail.FYLBBM = "西药费"; break;
                            case 476: inpatient_dr_detail.FYLBBM = "中成药费"; break;
                            case 477: inpatient_dr_detail.FYLBBM = "化验费"; break;
                            case 478: inpatient_dr_detail.FYLBBM = "孕产期检验"; break;
                            case 479: inpatient_dr_detail.FYLBBM = "治疗费"; break;
                            case 480: inpatient_dr_detail.FYLBBM = "医用材料费"; break;
                            case 481: inpatient_dr_detail.FYLBBM = "摄片费"; break;
                            case 482: inpatient_dr_detail.FYLBBM = "CT费"; break;
                            case 483: inpatient_dr_detail.FYLBBM = "检查费"; break;
                            case 484: inpatient_dr_detail.FYLBBM = "孕产期检查"; break;
                            case 485: inpatient_dr_detail.FYLBBM = "核磁共振"; break;
                            case 486: inpatient_dr_detail.FYLBBM = "输氧费"; break;
                            case 487: inpatient_dr_detail.FYLBBM = "输血费"; break;
                            case 488: inpatient_dr_detail.FYLBBM = "抢救费"; break;
                            case 489: inpatient_dr_detail.FYLBBM = "证书费"; break;
                            case 490: inpatient_dr_detail.FYLBBM = "饮食费"; break;
                            case 491: inpatient_dr_detail.FYLBBM = "病理费"; break;
                            case 492: inpatient_dr_detail.FYLBBM = "住院费"; break;
                            case 493: inpatient_dr_detail.FYLBBM = "诊疗费"; break;
                            case 494: inpatient_dr_detail.FYLBBM = "三级医院诊疗费"; break;
                            case 495: inpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; break;
                            case 496: inpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; break;
                            case 497: inpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; break;
                            case 498: inpatient_dr_detail.FYLBBM = "点名专家1诊疗费"; break;
                            case 499: inpatient_dr_detail.FYLBBM = "点名专家2诊疗费"; break;
                            case 500: inpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; break;
                            case 501: inpatient_dr_detail.FYLBBM = "手术费"; break;
                            case 502: inpatient_dr_detail.FYLBBM = "透视费"; break;
                            case 503: inpatient_dr_detail.FYLBBM = "出诊费"; break;
                            case 504: inpatient_dr_detail.FYLBBM = "留观费"; break;
                            case 505: inpatient_dr_detail.FYLBBM = "其他"; break;
                            case 506: inpatient_dr_detail.FYLBBM = "病史复印费"; break;
                            case 507: inpatient_dr_detail.FYLBBM = "健康检查费"; break;
                            case 508: inpatient_dr_detail.FYLBBM = "工本费"; break;
                            case 509: inpatient_dr_detail.FYLBBM = "磁卡费"; break;
                            case 510: inpatient_dr_detail.FYLBBM = "中草药费"; break;
                            case 511: inpatient_dr_detail.FYLBBM = "护理费"; break;
                            case 588: inpatient_dr_detail.FYLBBM = "特需门诊"; break;
                            case 589: inpatient_dr_detail.FYLBBM = "核磁共振"; break;
                            case 590: inpatient_dr_detail.FYLBBM = "证书费"; break;
                            case 591: inpatient_dr_detail.FYLBBM = "孕产期检查"; break;
                            case 592: inpatient_dr_detail.FYLBBM = "病史复印费"; break;
                            case 593: inpatient_dr_detail.FYLBBM = "西药费"; break;
                            case 594: inpatient_dr_detail.FYLBBM = "药费"; break;
                            case 595: inpatient_dr_detail.FYLBBM = "医用材料费"; break;
                            case 596: inpatient_dr_detail.FYLBBM = "治疗费"; break;
                            case 597: inpatient_dr_detail.FYLBBM = "中草药费"; break;
                            case 598: inpatient_dr_detail.FYLBBM = "检查费"; break;
                            case 599: inpatient_dr_detail.FYLBBM = "诊疗费"; break;
                            case 600: inpatient_dr_detail.FYLBBM = "其他"; break;
                            case 601: inpatient_dr_detail.FYLBBM = "化验费"; break;
                            case 602: inpatient_dr_detail.FYLBBM = "摄片费"; break;
                            case 603: inpatient_dr_detail.FYLBBM = "输血费"; break;
                            case 604: inpatient_dr_detail.FYLBBM = "护理费"; break;
                            case 605: inpatient_dr_detail.FYLBBM = "输氧费"; break;
                            case 606: inpatient_dr_detail.FYLBBM = "诊疗费(自)"; break;
                            case 607: inpatient_dr_detail.FYLBBM = "出诊费"; break;
                            case 608: inpatient_dr_detail.FYLBBM = "CT费"; break;
                            case 609: inpatient_dr_detail.FYLBBM = "住院费"; break;
                            case 610: inpatient_dr_detail.FYLBBM = "手术费"; break;
                            case 611: inpatient_dr_detail.FYLBBM = "饮食费"; break;
                            case 612: inpatient_dr_detail.FYLBBM = "留观费"; break;
                            case 613: inpatient_dr_detail.FYLBBM = "抢救费"; break;
                            case 614: inpatient_dr_detail.FYLBBM = "健康检查费"; break;
                            case 615: inpatient_dr_detail.FYLBBM = "卧位"; break;
                            case 616: inpatient_dr_detail.FYLBBM = "病危通知"; break;
                            case 617: inpatient_dr_detail.FYLBBM = "出院通知"; break;
                            case 618: inpatient_dr_detail.FYLBBM = "会诊费"; break;
                            case 619: inpatient_dr_detail.FYLBBM = "病理费"; break;
                            case 620: inpatient_dr_detail.FYLBBM = "透视费"; break;
                            case 621: inpatient_dr_detail.FYLBBM = "死亡通知"; break;
                            case 622: inpatient_dr_detail.FYLBBM = "西药费"; break;
                            case 623: inpatient_dr_detail.FYLBBM = "中成药费"; break;
                            case 624: inpatient_dr_detail.FYLBBM = "化验费"; break;
                            case 625: inpatient_dr_detail.FYLBBM = "治疗费"; break;
                            case 626: inpatient_dr_detail.FYLBBM = "医用材料费"; break;
                            case 627: inpatient_dr_detail.FYLBBM = "摄片费"; break;
                            case 628: inpatient_dr_detail.FYLBBM = "CT费"; break;
                            case 629: inpatient_dr_detail.FYLBBM = "检查费"; break;
                            case 630: inpatient_dr_detail.FYLBBM = "核磁共振"; break;
                            case 631: inpatient_dr_detail.FYLBBM = "输氧费"; break;
                            case 632: inpatient_dr_detail.FYLBBM = "输血费"; break;
                            case 633: inpatient_dr_detail.FYLBBM = "抢救费"; break;
                            case 634: inpatient_dr_detail.FYLBBM = "证书费"; break;
                            case 635: inpatient_dr_detail.FYLBBM = "饮食费"; break;
                            case 636: inpatient_dr_detail.FYLBBM = "病理费"; break;
                            case 637: inpatient_dr_detail.FYLBBM = "住院费"; break;
                            case 638: inpatient_dr_detail.FYLBBM = "诊疗费"; break;
                            case 639: inpatient_dr_detail.FYLBBM = "三级医院诊疗费"; break;
                            case 640: inpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; break;
                            case 641: inpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; break;
                            case 642: inpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; break;
                            case 643: inpatient_dr_detail.FYLBBM = "点名专家1诊疗费"; break;
                            case 644: inpatient_dr_detail.FYLBBM = "点名专家2诊疗费"; break;
                            case 645: inpatient_dr_detail.FYLBBM = "空号"; break;
                            case 646: inpatient_dr_detail.FYLBBM = "手术费"; break;
                            case 647: inpatient_dr_detail.FYLBBM = "透视费"; break;
                            case 648: inpatient_dr_detail.FYLBBM = "出诊费"; break;
                            case 649: inpatient_dr_detail.FYLBBM = "留观费"; break;
                            case 650: inpatient_dr_detail.FYLBBM = "其他"; break;
                            case 651: inpatient_dr_detail.FYLBBM = "病史复印费"; break;
                            case 652: inpatient_dr_detail.FYLBBM = "健康检查费"; break;
                            case 653: inpatient_dr_detail.FYLBBM = "工本费"; break;
                            case 654: inpatient_dr_detail.FYLBBM = "磁卡费"; break;
                            case 655: inpatient_dr_detail.FYLBBM = "中草药费"; break;
                            case 656: inpatient_dr_detail.FYLBBM = "护理费"; break;
                            case 657: inpatient_dr_detail.FYLBBM = "孕产期检查"; break;
                            case 658: inpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; break;
                            case 659: inpatient_dr_detail.FYLBBM = "孕产期检验"; break;
                            case 660: inpatient_dr_detail.FYLBBM = "西药费"; break;
                            case 661: inpatient_dr_detail.FYLBBM = "中成药费"; break;
                            case 662: inpatient_dr_detail.FYLBBM = "化验费"; break;
                            case 663: inpatient_dr_detail.FYLBBM = "孕产期检验"; break;
                            case 664: inpatient_dr_detail.FYLBBM = "治疗费"; break;
                            case 665: inpatient_dr_detail.FYLBBM = "医用材料费"; break;
                            case 666: inpatient_dr_detail.FYLBBM = "摄片费"; break;
                            case 667: inpatient_dr_detail.FYLBBM = "CT费"; break;
                            case 668: inpatient_dr_detail.FYLBBM = "检查费"; break;
                            case 669: inpatient_dr_detail.FYLBBM = "孕产期检查"; break;
                            case 670: inpatient_dr_detail.FYLBBM = "核磁共振"; break;
                            case 671: inpatient_dr_detail.FYLBBM = "输氧费"; break;
                            case 672: inpatient_dr_detail.FYLBBM = "输血费"; break;
                            case 673: inpatient_dr_detail.FYLBBM = "抢救费"; break;
                            case 674: inpatient_dr_detail.FYLBBM = "证书费"; break;
                            case 675: inpatient_dr_detail.FYLBBM = "饮食费"; break;
                            case 676: inpatient_dr_detail.FYLBBM = "病理费"; break;
                            case 677: inpatient_dr_detail.FYLBBM = "住院费"; break;
                            case 678: inpatient_dr_detail.FYLBBM = "诊疗费"; break;
                            case 679: inpatient_dr_detail.FYLBBM = "三级医院诊疗费"; break;
                            case 680: inpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; break;
                            case 681: inpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; break;
                            case 682: inpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; break;
                            case 683: inpatient_dr_detail.FYLBBM = "点名高级专家诊疗费"; break;
                            case 684: inpatient_dr_detail.FYLBBM = "著名专家诊疗费"; break;
                            case 685: inpatient_dr_detail.FYLBBM = "空号"; break;
                            case 686: inpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; break;
                            case 687: inpatient_dr_detail.FYLBBM = "手术费"; break;
                            case 688: inpatient_dr_detail.FYLBBM = "透视费"; break;
                            case 689: inpatient_dr_detail.FYLBBM = "出诊费"; break;
                            case 690: inpatient_dr_detail.FYLBBM = "留观费"; break;
                            case 691: inpatient_dr_detail.FYLBBM = "其他"; break;
                            case 692: inpatient_dr_detail.FYLBBM = "病史复印费"; break;
                            case 693: inpatient_dr_detail.FYLBBM = "健康检查费"; break;
                            case 694: inpatient_dr_detail.FYLBBM = "工本费"; break;
                            case 695: inpatient_dr_detail.FYLBBM = "磁卡费"; break;
                            case 696: inpatient_dr_detail.FYLBBM = "中草药费"; break;
                            case 697: inpatient_dr_detail.FYLBBM = "护理费"; break;
                            case 698: inpatient_dr_detail.FYLBBM = "会诊费"; break;
                            case 699: inpatient_dr_detail.FYLBBM = "西药费"; break;
                            case 700: inpatient_dr_detail.FYLBBM = "中成药费"; break;
                            case 701: inpatient_dr_detail.FYLBBM = "化验费"; break;
                            case 702: inpatient_dr_detail.FYLBBM = "孕产期检验"; break;
                            case 703: inpatient_dr_detail.FYLBBM = "治疗费"; break;
                            case 704: inpatient_dr_detail.FYLBBM = "医用材料费"; break;
                            case 705: inpatient_dr_detail.FYLBBM = "摄片费"; break;
                            case 706: inpatient_dr_detail.FYLBBM = "CT费"; break;
                            case 707: inpatient_dr_detail.FYLBBM = "检查费"; break;
                            case 708: inpatient_dr_detail.FYLBBM = "孕产期检查"; break;
                            case 709: inpatient_dr_detail.FYLBBM = "核磁共振"; break;
                            case 710: inpatient_dr_detail.FYLBBM = "输氧费"; break;
                            case 711: inpatient_dr_detail.FYLBBM = "输血费"; break;
                            case 712: inpatient_dr_detail.FYLBBM = "抢救费"; break;
                            case 713: inpatient_dr_detail.FYLBBM = "证书费"; break;
                            case 714: inpatient_dr_detail.FYLBBM = "饮食费"; break;
                            case 715: inpatient_dr_detail.FYLBBM = "病理费"; break;
                            case 716: inpatient_dr_detail.FYLBBM = "住院费"; break;
                            case 717: inpatient_dr_detail.FYLBBM = "诊疗费"; break;
                            case 718: inpatient_dr_detail.FYLBBM = "三级医院诊疗费"; break;
                            case 719: inpatient_dr_detail.FYLBBM = "副主任医师诊疗费"; break;
                            case 720: inpatient_dr_detail.FYLBBM = "正主任医师诊疗费"; break;
                            case 721: inpatient_dr_detail.FYLBBM = "不点名专家诊疗费"; break;
                            case 722: inpatient_dr_detail.FYLBBM = "点名专家1诊疗费"; break;
                            case 723: inpatient_dr_detail.FYLBBM = "点名专家2诊疗费"; break;
                            case 724: inpatient_dr_detail.FYLBBM = "点名专家3诊疗费"; break;
                            case 725: inpatient_dr_detail.FYLBBM = "手术费"; break;
                            case 726: inpatient_dr_detail.FYLBBM = "透视费"; break;
                            case 727: inpatient_dr_detail.FYLBBM = "出诊费"; break;
                            case 728: inpatient_dr_detail.FYLBBM = "留观费"; break;
                            case 729: inpatient_dr_detail.FYLBBM = "其他"; break;
                            case 730: inpatient_dr_detail.FYLBBM = "病史复印费"; break;
                            case 731: inpatient_dr_detail.FYLBBM = "健康检查费"; break;
                            case 732: inpatient_dr_detail.FYLBBM = "工本费"; break;
                            case 733: inpatient_dr_detail.FYLBBM = "磁卡费"; break;
                            case 734: inpatient_dr_detail.FYLBBM = "中草药费"; break;
                            case 735: inpatient_dr_detail.FYLBBM = "护理费"; break;
                            default: inpatient_dr_detail.FYLBBM = "不明";break;
                        }
                    }
 
 
                    
                    
                    
                    #endregion

                    #region 医嘱下达时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_005"]))
                    {
                        inpatient_dr_detail.YZXDSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_dr_detail.YZXDSJ = Convert.ToDateTime(dta.Rows[i]["c_date_005"]);
                    }
                    #endregion

                    #region 医嘱执行时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_002"]))
                    {
                        inpatient_dr_detail.YZZXSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_dr_detail.YZZXSJ = Convert.ToDateTime(dta.Rows[i]["c_date_002"]);
                    }
                    #endregion

                    #region 医嘱取消时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_003"]))
                    {
                        inpatient_dr_detail.YZQXSJ = Convert.ToDateTime("2000-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_dr_detail.YZQXSJ = Convert.ToDateTime(dta.Rows[i]["c_date_003"]);
                    }
                    #endregion

                    #region 医嘱终止时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        inpatient_dr_detail.YZZZSJ = Convert.ToDateTime("2000-01-01 00:00:00");
                    }
                    else
                    {
                        inpatient_dr_detail.YZZZSJ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion

                    #region 创建时间
                    inpatient_dr_detail.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    #endregion

                    #region 其他
                    inpatient_dr_detail.XGBZ = 0;
                    inpatient_dr_detail.YLYL1 = null;
                    inpatient_dr_detail.YLYL2 = null;
                    #endregion
                    #endregion

                    list.Add(inpatient_dr_detail);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                }

                access.InsertList(list, bar);
                list.Clear();
                dta.Clear();
                //MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将门诊收费结算表存入数据库
        /// </summary>
        public void Outpatient_Fee_Settle_TransByDB()
        {
            Outpatient_Fee_SettleAccess access = new Outpatient_Fee_SettleAccess();
            List<Outpatient_Fee_Settle> list = new List<Outpatient_Fee_Settle>();
              
            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Outpatient_Fee_Settle"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getOut_Fee_Settle_DataTable(create_time,access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getOut_Fee_Settle_DataTable(create_time, access);
                }
              
                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Outpatient_Fee_Settle out_fee_settle = new Outpatient_Fee_Settle();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充
                    #region 医疗机构代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_020"]))
                    {
                        out_fee_settle.YLJGDM = "不明";
                    }
                    else
                    {
                        out_fee_settle.	YLJGDM = dta.Rows[i]["c_str_020"].ToString();
                    }
                    #endregion

                    #region 结算收据号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        out_fee_settle.JSSJH = "不明";
                    }
                    else
                    {
                        out_fee_settle.	JSSJH = dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_015"]))
                    {
                        out_fee_settle.JZLSH = 0;
                    }
                    else
                    {
                        out_fee_settle.	JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_015"]);
                    }
                    #endregion

                    #region 病人ID
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        out_fee_settle.PatientID = 0;
                    }
                    else
                    {
                        out_fee_settle.	PatientID = Convert.ToInt32(dta.Rows[i]["c_int_000"]);
                    }
                    #endregion

                    #region 卡号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        out_fee_settle.KH = "不明";
                    }
                    else
                    {
                        out_fee_settle.	KH = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 卡类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                    {
                        out_fee_settle.KLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "0")
                    {
                        out_fee_settle.KLX = "社保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "1")
                    {
                        out_fee_settle.KLX = "医保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "2")
                    {
                        out_fee_settle.KLX = "医联卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "3")
                    {
                        out_fee_settle.KLX = "医院就医卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "9")
                    {
                        out_fee_settle.KLX = "其他";
                    }
                    #endregion

                    #region 门诊号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        out_fee_settle.MZH = "不明";
                    }
                    else
                    {
                        out_fee_settle.	MZH = dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion

                    #region 姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_003"]))
                    {
                        out_fee_settle.XM = "不明";
                    }
                    else
                    {
                        out_fee_settle.	XM = dta.Rows[i]["c_str_003"].ToString();
                    }
                    #endregion

                    #region 门诊医生工号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_017"]))
                    {
                        out_fee_settle.MZYSGH = 0;
                    }
                    else
                    {
                        out_fee_settle.	MZYSGH = Convert.ToInt32(dta.Rows[i]["c_int_017"]);
                    }
                    #endregion

                    #region 门诊医生姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_026"]))
                    {
                        out_fee_settle.MZYSXM = "不明";
                    }
                    else
                    {
                        out_fee_settle.	MZYSXM = dta.Rows[i]["c_str_026"].ToString();
                    }
                    #endregion

                    #region 就诊科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_010"]))
                    {
                        out_fee_settle.JZKSBM = 0;
                    }
                    else
                    {
                        out_fee_settle.	JZKSBM = Convert.ToInt32(dta.Rows[i]["c_int_010"]);
                    }
                    #endregion

                    #region 就诊科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_009"]))
                    {
                        out_fee_settle.JZKSMC = "不明";
                    }
                    else
                    {
                        out_fee_settle.	JZKSMC = dta.Rows[i]["c_str_009"].ToString();
                    }
                    #endregion

                    #region 结算科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        out_fee_settle.JSKSBM = 0;
                    }
                    else
                    {
                        out_fee_settle.	JSKSBM = Convert.ToInt32(dta.Rows[i]["c_int_002"]);
                    }
                    #endregion

                    #region 结算科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_007"]))
                    {
                        out_fee_settle.JSKSMC = "不明";
                    }
                    else
                    {
                        out_fee_settle.	JSKSMC = dta.Rows[i]["c_str_007"].ToString();
                    }
                    #endregion

                    #region 病人费别代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        out_fee_settle.BRFBDM = 0;
                    }
                    else
                    {
                        out_fee_settle.	BRFBDM = Convert.ToInt32(dta.Rows[i]["c_int_009"]);
                    }
                    #endregion

                    #region 病人费别名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        out_fee_settle.BRFBMC = "不明";
                    }
                    else
                    {
                        out_fee_settle.	BRFBMC = dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 医保范围总额
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_009"]))
                    {
                        out_fee_settle.YBFWZE = 0;
                    }
                    else
                    {
                        out_fee_settle.	YBFWZE = Convert.ToDecimal(dta.Rows[i]["c_float_009"]);
                    }
                    #endregion

                    #region 医保基金支付
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_008"]))
                    {
                        out_fee_settle.YBJJZF = 0;
                    }
                    else
                    {
                        out_fee_settle.YBJJZF = Convert.ToDecimal(dta.Rows[i]["c_float_008"]);
                    }
                    #endregion

                    #region 医保负担部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_005"]))
                    {
                        out_fee_settle.YBFDBF = 0;
                    }
                    else
                    {
                        out_fee_settle.	YBFDBF = Convert.ToDecimal(dta.Rows[i]["c_float_005"]);
                    }
                    #endregion

                    #region 医保自负部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_004"]))
                    {
                        out_fee_settle.YBZFBF = 0;
                    }
                    else
                    {
                        out_fee_settle.	YBZFBF = Convert.ToDecimal(dta.Rows[i]["c_float_004"]);
                    }
                    #endregion

                    #region 医保分类自负部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_006"]))
                    {
                        out_fee_settle.YBFLZF = 0;
                    }
                    else
                    {
                        out_fee_settle.	YBFLZF = Convert.ToDecimal(dta.Rows[i]["c_float_006"]);
                    }
                    #endregion

                    #region 医保范围外个人自费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_018"]))
                    {
                        out_fee_settle.GRZF = 0;
                    }
                    else
                    {
                        out_fee_settle.	GRZF = Convert.ToDecimal(dta.Rows[i]["c_float_018"]);
                    }
                    #endregion

                    #region 自费金额
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_003"]))
                    {
                        out_fee_settle.ZFJE = 0;
                    }
                    else
                    {
                        out_fee_settle.	ZFJE = Convert.ToDecimal(dta.Rows[i]["c_float_003"]);
                    }
                    #endregion

                    #region 总费用
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_007"]))
                    {
                        out_fee_settle.ZFY = 0;
                    }
                    else
                    {
                        out_fee_settle.	ZFY = Convert.ToDecimal(dta.Rows[i]["c_float_007"]);
                    }
                    #endregion

                    #region 总金额
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_000"]))
                    {
                        out_fee_settle.ZJE = 0;
                    }
                    else
                    {
                        out_fee_settle.	ZJE = Convert.ToDecimal(dta.Rows[i]["c_float_000"]);
                    }
                    #endregion

                    #region 收费记录状态
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        out_fee_settle.SFJLZT = 0;
                    }
                    else
                    {
                        out_fee_settle.SFJLZT = Convert.ToInt32(dta.Rows[i]["c_int_004"]);
                    }
                    #endregion

                    #region 结算时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        out_fee_settle.JSSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        out_fee_settle.JSSJ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion

                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        out_fee_settle.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        out_fee_settle.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    out_fee_settle.XGBZ = 0;
                    out_fee_settle.YLYL1 = null;
                    out_fee_settle.YLYL2 = null;
                    #endregion

                    #endregion

                    list.Add(out_fee_settle);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
            
                }
                access.InsertList(list);
                list.Clear();
                dta.Clear();

               // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将住院收费结算表存入数据库
        /// </summary>
        public void Inpatient_Fee_Settle_TransByDB()
        {
            Inpatient_Fee_SettleAccess access = new Inpatient_Fee_SettleAccess();
            List<Inpatient_Fee_Settle> list = new List<Inpatient_Fee_Settle>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Inpatient_Fee_Settle"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getIn_Fee_Settle_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getIn_Fee_Settle_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Inpatient_Fee_Settle in_fee_settle = new Inpatient_Fee_Settle();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 医疗机构代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_020"]))
                    {
                        in_fee_settle.YLJGDM = "不明";
                    }
                    else
                    {
                        in_fee_settle.YLJGDM = dta.Rows[i]["c_str_020"].ToString();
                    }
                    #endregion

                    #region 结算收据号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        in_fee_settle.JSSJH = "不明";
                    }
                    else
                    {
                        in_fee_settle.JSSJH = dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_015"]))
                    {
                        in_fee_settle.JZLSH = 0;
                    }
                    else
                    {
                        in_fee_settle.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_015"]);
                    }
                    #endregion

                    #region 病人ID
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        in_fee_settle.PatientID = 0;
                    }
                    else
                    {
                        in_fee_settle.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_000"]);
                    }
                    #endregion

                    #region 卡号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        in_fee_settle.KH = "不明";
                    }
                    else
                    {
                        in_fee_settle.KH = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 卡类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                    {
                        in_fee_settle.KLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "0")
                    {
                        in_fee_settle.KLX = "社保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "1")
                    {
                        in_fee_settle.KLX = "医保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "2")
                    {
                        in_fee_settle.KLX = "医联卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "3")
                    {
                        in_fee_settle.KLX = "医院就医卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "9")
                    {
                        in_fee_settle.KLX = "其他";
                    }
                    #endregion

                    #region 住院号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        in_fee_settle.ZYH = "不明";
                    }
                    else
                    {
                        in_fee_settle.ZYH = dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion

                    #region 姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_003"]))
                    {
                        in_fee_settle.XM = "不明";
                    }
                    else
                    {
                        in_fee_settle.XM = dta.Rows[i]["c_str_003"].ToString();
                    }
                    #endregion

                    #region 住院天数
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_012"]))
                    {
                        in_fee_settle.ZYTS = 0;
                    }
                    else
                    {
                        in_fee_settle.ZYTS = Convert.ToInt32(dta.Rows[i]["c_int_012"]);
                    }
                    #endregion

                    #region 病区代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_013"]))
                    {
                        in_fee_settle.BQDM = 0;
                    }
                    else
                    {
                        in_fee_settle.BQDM = Convert.ToInt32(dta.Rows[i]["c_int_013"]);
                    }
                    #endregion

                    #region 病区名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_010"]))
                    {
                        in_fee_settle.BQMC = "不明";
                    }
                    else
                    {
                        in_fee_settle.BQMC = dta.Rows[i]["c_str_010"].ToString();
                    }
                    #endregion

                    #region 就诊科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_010"]))
                    {
                        in_fee_settle.JZKSBM = 0;
                    }
                    else
                    {
                        in_fee_settle.JZKSBM = Convert.ToInt32(dta.Rows[i]["c_int_010"]);
                    }
                    #endregion

                    #region 就诊科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_009"]))
                    {
                        in_fee_settle.JZKSMC = "不明";
                    }
                    else
                    {
                        in_fee_settle.JZKSMC = dta.Rows[i]["c_str_009"].ToString();
                    }
                    #endregion

                    #region 结算科室编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        in_fee_settle.JSKSBM = 0;
                    }
                    else
                    {
                        in_fee_settle.JSKSBM = Convert.ToInt32(dta.Rows[i]["c_int_002"]);
                    }
                    #endregion

                    #region 结算科室名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_007"]))
                    {
                        in_fee_settle.JSKSMC = "不明";
                    }
                    else
                    {
                        in_fee_settle.JSKSMC = dta.Rows[i]["c_str_007"].ToString();
                    }
                    #endregion

                    #region 病人费别代码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        in_fee_settle.BRFBDM = 0;
                    }
                    else
                    {
                        in_fee_settle.BRFBDM =	Convert.ToInt32(dta.Rows[i]["c_int_009"]);
                    }
                    #endregion

                    #region 病人费别名称
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        in_fee_settle.BRFBMC = "不明";
                    }
                    else
                    {
                        in_fee_settle.BRFBMC = dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 医保范围总额
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_009"]))
                    {
                        in_fee_settle.YBFWZE = 0;
                    }
                    else
                    {
                        in_fee_settle.YBFWZE = Convert.ToDecimal(dta.Rows[i]["c_float_009"]);
                    }
                    #endregion

                    #region 医保基金支付
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_008"]))
                    {
                        in_fee_settle.YBJJZF = 0;
                    }
                    else
                    {
                        in_fee_settle.YBJJZF = Convert.ToDecimal(dta.Rows[i]["c_float_008"]);
                    }
                    #endregion

                    #region 医保负担部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_005"]))
                    {
                        in_fee_settle.YBFDBF = 0;
                    }
                    else
                    {
                        in_fee_settle.YBFDBF = Convert.ToDecimal(dta.Rows[i]["c_float_005"]);
                    }
                    #endregion

                    #region 医保自费部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_004"]))
                    {
                        in_fee_settle.YBZFBF = 0;
                    }
                    else
                    {
                        in_fee_settle.YBZFBF = Convert.ToDecimal(dta.Rows[i]["c_float_004"]);
                    }
                    #endregion

                    #region 医保分类自负部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_006"]))
                    {
                        in_fee_settle.YBFLZF = 0;
                    }
                    else
                    {
                        in_fee_settle.YBFLZF = Convert.ToDecimal(dta.Rows[i]["c_float_006"]);
                    }
                    #endregion

                    #region 医保范围外个人自付部分
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_018"]))
                    {
                        in_fee_settle.GRZF = 0;
                    }
                    else
                    {
                        in_fee_settle.GRZF = Convert.ToDecimal(dta.Rows[i]["c_float_018"]);
                    }
                    #endregion

                    #region 自费金额
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_003"]))
                    {
                        in_fee_settle.ZFJE = 0;
                    }
                    else
                    {
                        in_fee_settle.ZFJE = Convert.ToDecimal(dta.Rows[i]["c_float_003"]);
                    }
                    #endregion

                    #region 总费用
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_007"]))
                    {
                        in_fee_settle.ZFY = 0;
                    }
                    else
                    {
                        in_fee_settle.ZFY = Convert.ToDecimal(dta.Rows[i]["c_float_007"]);
                    }
                    #endregion

                    #region 总金额
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_000"]))
                    {
                        in_fee_settle.ZJE = 0;
                    }
                    else
                    {
                        in_fee_settle.ZJE = Convert.ToDecimal(dta.Rows[i]["c_float_000"]);
                    }
                    #endregion

                    #region 收费记录状态
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        in_fee_settle.SFJLZT = "不明";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "0")
                    {
                        in_fee_settle.SFJLZT = "正常";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "1")
                    {
                        in_fee_settle.SFJLZT = "退费";
                    }
                    else if (dta.Rows[i]["c_int_004"].ToString() == "2")
                    {
                        in_fee_settle.SFJLZT = "红冲";
                    }
                    #endregion

                    #region 住院结算状态
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_011"]))
                    {
                        in_fee_settle.ZYJSZT = "不明";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "1")
                    {
                        in_fee_settle.ZYJSZT = "未结算";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "2")
                    {
                        in_fee_settle.ZYJSZT = "已结算";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "3")
                    {
                        in_fee_settle.ZYJSZT = "在院结算";
                    }
                    #endregion

                    #region 结算时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        in_fee_settle.JSSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        in_fee_settle.JSSJ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion

                    #region 入院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_001"]))
                    {
                        in_fee_settle.RYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        in_fee_settle.RYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_001"]);
                    }
                    #endregion

                    #region 出院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_002"]))
                    {
                        in_fee_settle.CYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        in_fee_settle.CYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_002"]);
                    }
                    #endregion

                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        in_fee_settle.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        in_fee_settle.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    in_fee_settle.XGBZ = 0;
                    in_fee_settle.YLYL1 = null;
                    in_fee_settle.YLYL2 = null;
                    #endregion

                    #endregion
                    list.Add(in_fee_settle);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }
                access.InsertList(list);
                list.Clear();
                dta.Clear();

                //MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将门诊收费明细表存入数据库
        /// </summary>
        public void Outpatient_Fee_Detail_TransByDB()
        {
            Outpatient_Fee_DetailAccess access = new Outpatient_Fee_DetailAccess();
            List<Outpatient_Fee_Detail> list = new List<Outpatient_Fee_Detail>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Outpatient_Fee_Detail"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getOut_Fee_Detail_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getOut_Fee_Detail_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Outpatient_Fee_Detail out_fee_detail = new Outpatient_Fee_Detail();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 医疗机构代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_023"]))
                    {
                        out_fee_detail.YLJGDM = "不明";
                    }
                    else
                    {
                        out_fee_detail.YLJGDM = dta.Rows[i]["c_str_023"].ToString();
                    }
                    #endregion

                    #region 明细ID

                    #endregion

                    #region 结算收据号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_008"]))
                    {
                        out_fee_detail.JSSJH = "不明";
                    }
                    else
                    {
                        out_fee_detail.JSSJH = dta.Rows[i]["c_str_008"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_014"]))
                    {
                        out_fee_detail.JZLSH = 0;
                    }
                    else
                    {
                        out_fee_detail.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_014"]);
                    }
                    #endregion

                    #region 病人ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        out_fee_detail.PatientID = 0;
                    }
                    else
                    {
                        out_fee_detail.PatientID = 	Convert.ToInt32(dta.Rows[i]["c_int_004"]);	
                    }
                    #endregion

                    #region 卡号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_022"]))
                    {
                        out_fee_detail.KH = "不明";
                    }
                    else
                    {
                        out_fee_detail.KH = dta.Rows[i]["c_str_022"].ToString();
                    }
                    #endregion

                    #region 卡类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_017"]))
                    {
                        out_fee_detail.KLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "0")
                    {
                        out_fee_detail.KLX = "社保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "1")
                    {
                        out_fee_detail.KLX = "医保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "2")
                    {
                        out_fee_detail.KLX = "医联卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "3")
                    {
                        out_fee_detail.KLX = "医院就医卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "9")
                    {
                        out_fee_detail.KLX = "其他";
                    }
                    #endregion

                    #region 医嘱记录号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_030"]))
                    {
                        out_fee_detail.YZJLH = "不明";
                    }
                    else
                    {
                        out_fee_detail.YZJLH = 	dta.Rows[i]["c_str_030"].ToString();
                    }
                    #endregion

                    #region 相关医嘱ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_015"]))
                    {
                        out_fee_detail.XGYZID = "不明";
                    }
                    else
                    {
                        out_fee_detail.XGYZID = dta.Rows[i]["c_str_015"].ToString();
                    }
                    #endregion

                    #region 科室代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int011"]))
                    {
                        out_fee_detail.KSDM	= 0;
                    }
                    else
                    {
                        out_fee_detail.KSDM	= Convert.ToInt32(dta.Rows[i]["c_int_011"]);	
                    }
                    #endregion

                    #region 科室名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_007"]))
                    {
                        out_fee_detail.KSMC	= "不明";
                    }
                    else
                    {
                        out_fee_detail.KSMC	= dta.Rows[i]["c_str_007"].ToString();
                    }
                    #endregion

                    #region 医保药品编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_031"]))
                    {
                        out_fee_detail.YBYPBM = "不明";
                    }
                    else
                    {
                        out_fee_detail.YBYPBM = dta.Rows[i]["c_str_031"].ToString();
                    }
                    #endregion

                    #region 明细费用类别编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_015"]))
                    {
                        out_fee_detail.MXFYLBBM = "不明";
                    }
                    else 
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_015"]))
                        {
                            case 474:  out_fee_detail.MXFYLBBM = "会诊费"; break;  
                            case 475:  out_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 476:  out_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 477:  out_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 478:  out_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 479:  out_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 480:  out_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 481:  out_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 482:  out_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 483:  out_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 484:  out_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 485:  out_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 486:  out_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 487:  out_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 488:  out_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 489:  out_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 490:  out_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 491:  out_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 492:  out_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 493:  out_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 494:  out_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 495:  out_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 496:  out_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 497:  out_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 498:  out_fee_detail.MXFYLBBM = "点名专家1诊疗费"; break;  
                            case 499:  out_fee_detail.MXFYLBBM = "点名专家2诊疗费"; break;  
                            case 500:  out_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 501:  out_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 502:  out_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 503:  out_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 504:  out_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 505:  out_fee_detail.MXFYLBBM = "其他"; break;  
                            case 506:  out_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 507:  out_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 508:  out_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 509:  out_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 510:  out_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 511:  out_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 588:  out_fee_detail.MXFYLBBM = "特需门诊"; break;  
                            case 589:  out_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 590:  out_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 591:  out_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 592:  out_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 593:  out_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 594:  out_fee_detail.MXFYLBBM = "药费"; break;  
                            case 595:  out_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 596:  out_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 597:  out_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 598:  out_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 599:  out_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 600:  out_fee_detail.MXFYLBBM = "其他"; break;  
                            case 601:  out_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 602:  out_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 603:  out_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 604:  out_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 605:  out_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 606:  out_fee_detail.MXFYLBBM = "诊疗费(自)"; break;  
                            case 607:  out_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 608:  out_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 609:  out_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 610:  out_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 611:  out_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 612:  out_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 613:  out_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 614:  out_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 615:  out_fee_detail.MXFYLBBM = "卧位"; break;  
                            case 616:  out_fee_detail.MXFYLBBM = "病危通知"; break;  
                            case 617:  out_fee_detail.MXFYLBBM = "出院通知"; break;  
                            case 618:  out_fee_detail.MXFYLBBM = "会诊费"; break;  
                            case 619:  out_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 620:  out_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 621:  out_fee_detail.MXFYLBBM = "死亡通知"; break;  
                            case 622:  out_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 623:  out_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 624:  out_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 625:  out_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 626:  out_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 627:  out_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 628:  out_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 629:  out_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 630:  out_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 631:  out_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 632:  out_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 633:  out_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 634:  out_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 635:  out_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 636:  out_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 637:  out_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 638:  out_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 639:  out_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 640:  out_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 641:  out_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 642:  out_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 643:  out_fee_detail.MXFYLBBM = "点名专家1诊疗费"; break;  
                            case 644:  out_fee_detail.MXFYLBBM = "点名专家2诊疗费"; break;  
                            case 645:  out_fee_detail.MXFYLBBM = "空号"; break;  
                            case 646:  out_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 647:  out_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 648:  out_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 649:  out_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 650:  out_fee_detail.MXFYLBBM = "其他"; break;  
                            case 651:  out_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 652:  out_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 653:  out_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 654:  out_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 655:  out_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 656:  out_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 657:  out_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 658:  out_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 659:  out_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 660:  out_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 661:  out_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 662:  out_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 663:  out_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 664:  out_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 665:  out_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 666:  out_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 667:  out_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 668:  out_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 669:  out_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 670:  out_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 671:  out_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 672:  out_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 673:  out_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 674:  out_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 675:  out_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 676:  out_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 677:  out_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 678:  out_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 679:  out_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 680:  out_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 681:  out_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 682:  out_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 683:  out_fee_detail.MXFYLBBM = "点名高级专家诊疗费"; break;  
                            case 684:  out_fee_detail.MXFYLBBM = "著名专家诊疗费"; break;  
                            case 685:  out_fee_detail.MXFYLBBM = "空号"; break;  
                            case 686:  out_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 687:  out_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 688:  out_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 689:  out_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 690:  out_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 691:  out_fee_detail.MXFYLBBM = "其他"; break;  
                            case 692:  out_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 693:  out_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 694:  out_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 695:  out_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 696:  out_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 697:  out_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 698:  out_fee_detail.MXFYLBBM = "会诊费"; break;  
                            case 699:  out_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 700:  out_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 701:  out_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 702:  out_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 703:  out_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 704:  out_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 705:  out_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 706:  out_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 707:  out_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 708:  out_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 709:  out_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 710:  out_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 711:  out_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 712:  out_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 713:  out_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 714:  out_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 715:  out_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 716:  out_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 717:  out_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 718:  out_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 719:  out_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 720:  out_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 721:  out_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 722:  out_fee_detail.MXFYLBBM = "点名专家1诊疗费"; break;  
                            case 723:  out_fee_detail.MXFYLBBM = "点名专家2诊疗费"; break;  
                            case 724:  out_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 725:  out_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 726:  out_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 727:  out_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 728:  out_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 729:  out_fee_detail.MXFYLBBM = "其他"; break;  
                            case 730:  out_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 731:  out_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 732:  out_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 733:  out_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 734:  out_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 735:  out_fee_detail.MXFYLBBM = "护理费"; break;  
                    }
                    }
                    #endregion

                    #region 明细项目编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        out_fee_detail.MXXMBM = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMBM = Convert.ToInt32(dta.Rows[i]["c_int_009"]);
                    }
                    #endregion

                    #region 明细项目类别
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_003"]))
                    {
                        out_fee_detail.MXXMLB = "不明";
                    }
                    else 
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_003"]))
                        {
                            case 0: out_fee_detail.MXXMLB = "药品"; break;
                            case 1: out_fee_detail.MXXMLB = "治疗"; break;
                            case 2: out_fee_detail.MXXMLB = "手术"; break;
                            case 3: out_fee_detail.MXXMLB = "麻醉"; break;
                            case 4: out_fee_detail.MXXMLB = "膳食"; break;
                            case 5: out_fee_detail.MXXMLB = "输血"; break;
                            case 6: out_fee_detail.MXXMLB = "护理"; break;
                            case 7: out_fee_detail.MXXMLB = "床位"; break;
                            case 8: out_fee_detail.MXXMLB = "检查"; break;
                            case 9: out_fee_detail.MXXMLB = "检验"; break;
                            case 10: out_fee_detail.MXXMLB = "输液"; break;
                            case 11: out_fee_detail.MXXMLB = "材料"; break;
                            case 12: out_fee_detail.MXXMLB = "挂号"; break;
                            case 13: out_fee_detail.MXXMLB = "诊疗"; break;
                            case 14: out_fee_detail.MXXMLB = "其他"; break;
 
                        }
                    }

                    #endregion

                    #region 明细项目名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        out_fee_detail.MXXMMC = "不明";
                    }
                    else
                    {
                        out_fee_detail.MXXMMC = dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 明细项目单位
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_009"]))
                    {
                        out_fee_detail.MXXMDW = "不明";
                    }
                    else
                    {
                        out_fee_detail.MXXMDW = dta.Rows[i]["c_str_009"].ToString();
                    }
                    #endregion

                    #region 明细项目规格
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        out_fee_detail.MXXMGG = "不明";
                    }
                    else
                    {
                        out_fee_detail.MXXMGG = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 明细项目系数
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_005"]))
                    {
                        out_fee_detail.MXXMXS = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMXS = Convert.ToDecimal(dta.Rows[i]["c_float_005"]);
                    }
                    #endregion

                    #region 明细项目数量
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_006"]))
                    {
                        out_fee_detail.MXXMSL = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMSL = Convert.ToDecimal(dta.Rows[i]["c_float_006"]);
                    }
                    #endregion

                    #region 明细项目单价
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_007"]))
                    {
                        out_fee_detail.MXXMDJ = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMDJ = Convert.ToDecimal(dta.Rows[i]["c_float_007"]);
                    }
                    #endregion

                    #region 明细项目医保范围外自费金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_009"]))
                    {
                        out_fee_detail.MXXMZFW = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMZFW = Convert.ToDecimal(dta.Rows[i]["c_float_009"]);	
                    }
                    #endregion

                    #region 明细项目医保范围内分类自费金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_010"]))
                    {
                        out_fee_detail.MXXMZFN = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMZFN = Convert.ToDecimal(dta.Rows[i]["c_float_010"]);
                    }
                    #endregion

                    #region 明细项目金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_004"]))
                    {
                        out_fee_detail.MXXMJE = 0;
                    }
                    else
                    {
                        out_fee_detail.MXXMJE = Convert.ToDecimal(dta.Rows[i]["c_float_004"]);
                    }
                    #endregion

                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        out_fee_detail.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        out_fee_detail.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    out_fee_detail.XGBZ = 0;
                    out_fee_detail.YLYL1 = null;
                    out_fee_detail.YLYL2 = null;
                    #endregion

                    #endregion


                    list.Add(out_fee_detail);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将住院收费明细表存入数据库
        /// </summary>
        public void Inpatient_Fee_Detail_TransByDB()
        {
            Inpatient_Fee_DetailAccess access = new Inpatient_Fee_DetailAccess();
            List<Inpatient_Fee_Detail> list = new List<Inpatient_Fee_Detail>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Inpatient_Fee_Detail"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getIn_Fee_Detail_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getIn_Fee_Detail_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Inpatient_Fee_Detail in_fee_detail = new Inpatient_Fee_Detail();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 医疗机构代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_023"]))
                    {
                        in_fee_detail.YLJGDM = "不明";
                    }
                    else
                    {
                        in_fee_detail.YLJGDM = dta.Rows[i]["c_str_023"].ToString();
                    }
                    #endregion

                    #region 明细ID

                    #endregion

                    #region 结算收据号
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_008"]))
                    {
                        in_fee_detail.JSSJH = "不明";
                    }
                    else
                    {
                        in_fee_detail.JSSJH = dta.Rows[i]["c_str_008"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_014"]))
                    {
                        in_fee_detail.JZLSH = 0;
                    }
                    else
                    {
                        in_fee_detail.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_014"]);
                    }
                    #endregion

                    #region 病人ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        in_fee_detail.PatientID = 0;
                    }
                    else
                    {
                        in_fee_detail.PatientID = 	Convert.ToInt32(dta.Rows[i]["c_int_004"]);	
                    }
                    #endregion

                    #region 卡号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_022"]))
                    {
                        in_fee_detail.KH = "不明";
                    }
                    else
                    {
                        in_fee_detail.KH = dta.Rows[i]["c_str_022"].ToString();
                    }
                    #endregion

                    #region 卡类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_017"]))
                    {
                        in_fee_detail.KLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "0")
                    {
                        in_fee_detail.KLX = "社保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "1")
                    {
                        in_fee_detail.KLX = "医保卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "2")
                    {
                        in_fee_detail.KLX = "医联卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "3")
                    {
                        in_fee_detail.KLX = "医院就医卡";
                    }
                    else if (dta.Rows[i]["c_int_001"].ToString() == "9")
                    {
                        in_fee_detail.KLX = "其他";
                    }
                    #endregion

                    #region 住院结算状态
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_013"]))
                    {
                        in_fee_detail.ZYJSZT = "不明";
                    }
                    else if(dta.Rows[i]["c_int_013"].ToString() == "1")
                    {
                        in_fee_detail.ZYJSZT = "未结算";	
                    }
                    else if(dta.Rows[i]["c_int_013"].ToString() == "2")
                    {
                        in_fee_detail.ZYJSZT = "已结算";	
                    }
                    else if(dta.Rows[i]["c_int_013"].ToString() == "3")
                    {
                        in_fee_detail.ZYJSZT = "在院结算";	
                    }
                    #endregion

                    #region 医嘱记录号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_030"]))
                    {
                        in_fee_detail.YZJLH = "不明";
                    }
                    else
                    {
                        in_fee_detail.YZJLH = dta.Rows[i]["c_str_030"].ToString();
                    }
                    #endregion

                    #region 病区代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_012"]))
                    {
                        in_fee_detail.BQDM = 0;
                    }
                    else
                    {
                        in_fee_detail.BQDM = Convert.ToInt32(dta.Rows[i]["c_int_012"]);	
                    }
                    #endregion

                    #region 病区名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_010"]))
                    {
                        in_fee_detail.BQMC = "不明";
                    }
                    else
                    {
                        in_fee_detail.BQMC = dta.Rows[i]["c_str_010"].ToString();
                    }
                    #endregion

                    #region 科室代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int011"]))
                    {
                        in_fee_detail.KSDM	= 0;
                    }
                    else
                    {
                        in_fee_detail.KSDM	= Convert.ToInt32(dta.Rows[i]["c_int_011"]);	
                    }
                    #endregion

                    #region 科室名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_007"]))
                    {
                        in_fee_detail.KSMC	= "不明";
                    }
                    else
                    {
                        in_fee_detail.KSMC	= dta.Rows[i]["c_str_007"].ToString();
                    }
                    #endregion
                    
                    #region 执行科室代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_007"]))
                    {
                        in_fee_detail.ZXKSDM = 0;
                    }
                    else
                    {
                        in_fee_detail.ZXKSDM = Convert.ToInt32(dta.Rows[i]["c_int_007"]);	
                    }
                    #endregion

                    #region 执行科室名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        in_fee_detail.ZXKSMC	= "不明";
                    }
                    else
                    {
                        in_fee_detail.ZXKSMC	= dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion

                    #region 医保药品编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_031"]))
                    {
                        in_fee_detail.YBYPBM = "不明";
                    }
                    else
                    {
                        in_fee_detail.YBYPBM = dta.Rows[i]["c_str_031"].ToString();
                    }
                    #endregion
                    
                    #region 明细费用类别编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_015"]))
                    {
                        in_fee_detail.MXFYLBBM = "不明";
                    }
                    else 
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_015"]))
                        {
                            case 474:  in_fee_detail.MXFYLBBM = "会诊费"; break;  
                            case 475:  in_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 476:  in_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 477:  in_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 478:  in_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 479:  in_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 480:  in_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 481:  in_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 482:  in_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 483:  in_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 484:  in_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 485:  in_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 486:  in_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 487:  in_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 488:  in_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 489:  in_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 490:  in_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 491:  in_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 492:  in_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 493:  in_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 494:  in_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 495:  in_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 496:  in_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 497:  in_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 498:  in_fee_detail.MXFYLBBM = "点名专家1诊疗费"; break;  
                            case 499:  in_fee_detail.MXFYLBBM = "点名专家2诊疗费"; break;  
                            case 500:  in_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 501:  in_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 502:  in_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 503:  in_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 504:  in_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 505:  in_fee_detail.MXFYLBBM = "其他"; break;  
                            case 506:  in_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 507:  in_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 508:  in_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 509:  in_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 510:  in_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 511:  in_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 588:  in_fee_detail.MXFYLBBM = "特需门诊"; break;  
                            case 589:  in_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 590:  in_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 591:  in_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 592:  in_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 593:  in_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 594:  in_fee_detail.MXFYLBBM = "药费"; break;  
                            case 595:  in_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 596:  in_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 597:  in_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 598:  in_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 599:  in_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 600:  in_fee_detail.MXFYLBBM = "其他"; break;  
                            case 601:  in_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 602:  in_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 603:  in_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 604:  in_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 605:  in_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 606:  in_fee_detail.MXFYLBBM = "诊疗费(自)"; break;  
                            case 607:  in_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 608:  in_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 609:  in_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 610:  in_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 611:  in_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 612:  in_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 613:  in_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 614:  in_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 615:  in_fee_detail.MXFYLBBM = "卧位"; break;  
                            case 616:  in_fee_detail.MXFYLBBM = "病危通知"; break;  
                            case 617:  in_fee_detail.MXFYLBBM = "出院通知"; break;  
                            case 618:  in_fee_detail.MXFYLBBM = "会诊费"; break;  
                            case 619:  in_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 620:  in_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 621:  in_fee_detail.MXFYLBBM = "死亡通知"; break;  
                            case 622:  in_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 623:  in_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 624:  in_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 625:  in_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 626:  in_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 627:  in_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 628:  in_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 629:  in_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 630:  in_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 631:  in_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 632:  in_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 633:  in_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 634:  in_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 635:  in_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 636:  in_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 637:  in_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 638:  in_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 639:  in_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 640:  in_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 641:  in_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 642:  in_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 643:  in_fee_detail.MXFYLBBM = "点名专家1诊疗费"; break;  
                            case 644:  in_fee_detail.MXFYLBBM = "点名专家2诊疗费"; break;  
                            case 645:  in_fee_detail.MXFYLBBM = "空号"; break;  
                            case 646:  in_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 647:  in_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 648:  in_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 649:  in_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 650:  in_fee_detail.MXFYLBBM = "其他"; break;  
                            case 651:  in_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 652:  in_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 653:  in_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 654:  in_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 655:  in_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 656:  in_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 657:  in_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 658:  in_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 659:  in_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 660:  in_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 661:  in_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 662:  in_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 663:  in_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 664:  in_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 665:  in_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 666:  in_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 667:  in_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 668:  in_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 669:  in_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 670:  in_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 671:  in_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 672:  in_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 673:  in_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 674:  in_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 675:  in_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 676:  in_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 677:  in_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 678:  in_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 679:  in_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 680:  in_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 681:  in_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 682:  in_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 683:  in_fee_detail.MXFYLBBM = "点名高级专家诊疗费"; break;  
                            case 684:  in_fee_detail.MXFYLBBM = "著名专家诊疗费"; break;  
                            case 685:  in_fee_detail.MXFYLBBM = "空号"; break;  
                            case 686:  in_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 687:  in_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 688:  in_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 689:  in_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 690:  in_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 691:  in_fee_detail.MXFYLBBM = "其他"; break;  
                            case 692:  in_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 693:  in_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 694:  in_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 695:  in_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 696:  in_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 697:  in_fee_detail.MXFYLBBM = "护理费"; break;  
                            case 698:  in_fee_detail.MXFYLBBM = "会诊费"; break;  
                            case 699:  in_fee_detail.MXFYLBBM = "西药费"; break;  
                            case 700:  in_fee_detail.MXFYLBBM = "中成药费"; break;  
                            case 701:  in_fee_detail.MXFYLBBM = "化验费"; break;  
                            case 702:  in_fee_detail.MXFYLBBM = "孕产期检验"; break;  
                            case 703:  in_fee_detail.MXFYLBBM = "治疗费"; break;  
                            case 704:  in_fee_detail.MXFYLBBM = "医用材料费"; break;  
                            case 705:  in_fee_detail.MXFYLBBM = "摄片费"; break;  
                            case 706:  in_fee_detail.MXFYLBBM = "CT费"; break;  
                            case 707:  in_fee_detail.MXFYLBBM = "检查费"; break;  
                            case 708:  in_fee_detail.MXFYLBBM = "孕产期检查"; break;  
                            case 709:  in_fee_detail.MXFYLBBM = "核磁共振"; break;  
                            case 710:  in_fee_detail.MXFYLBBM = "输氧费"; break;  
                            case 711:  in_fee_detail.MXFYLBBM = "输血费"; break;  
                            case 712:  in_fee_detail.MXFYLBBM = "抢救费"; break;  
                            case 713:  in_fee_detail.MXFYLBBM = "证书费"; break;  
                            case 714:  in_fee_detail.MXFYLBBM = "饮食费"; break;  
                            case 715:  in_fee_detail.MXFYLBBM = "病理费"; break;  
                            case 716:  in_fee_detail.MXFYLBBM = "住院费"; break;  
                            case 717:  in_fee_detail.MXFYLBBM = "诊疗费"; break;  
                            case 718:  in_fee_detail.MXFYLBBM = "三级医院诊疗费"; break;  
                            case 719:  in_fee_detail.MXFYLBBM = "副主任医师诊疗费"; break;  
                            case 720:  in_fee_detail.MXFYLBBM = "正主任医师诊疗费"; break;  
                            case 721:  in_fee_detail.MXFYLBBM = "不点名专家诊疗费"; break;  
                            case 722:  in_fee_detail.MXFYLBBM = "点名专家1诊疗费"; break;  
                            case 723:  in_fee_detail.MXFYLBBM = "点名专家2诊疗费"; break;  
                            case 724:  in_fee_detail.MXFYLBBM = "点名专家3诊疗费"; break;  
                            case 725:  in_fee_detail.MXFYLBBM = "手术费"; break;  
                            case 726:  in_fee_detail.MXFYLBBM = "透视费"; break;  
                            case 727:  in_fee_detail.MXFYLBBM = "出诊费"; break;  
                            case 728:  in_fee_detail.MXFYLBBM = "留观费"; break;  
                            case 729:  in_fee_detail.MXFYLBBM = "其他"; break;  
                            case 730:  in_fee_detail.MXFYLBBM = "病史复印费"; break;  
                            case 731:  in_fee_detail.MXFYLBBM = "健康检查费"; break;  
                            case 732:  in_fee_detail.MXFYLBBM = "工本费"; break;  
                            case 733:  in_fee_detail.MXFYLBBM = "磁卡费"; break;  
                            case 734:  in_fee_detail.MXFYLBBM = "中草药费"; break;  
                            case 735:  in_fee_detail.MXFYLBBM = "护理费"; break;  
                    }
                    }
                    #endregion

                    #region 明细项目编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        in_fee_detail.MXXMBM = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMBM = Convert.ToInt32(dta.Rows[i]["c_int_009"]);
                    }
                    #endregion

                    #region 明细项目类别
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_003"]))
                    {
                        in_fee_detail.MXXMLB = "不明";
                    }
                    else 
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_int_003"]))
                        {
                            case 0: in_fee_detail.MXXMLB = "药品"; break;
                            case 1: in_fee_detail.MXXMLB = "治疗"; break;
                            case 2: in_fee_detail.MXXMLB = "手术"; break;
                            case 3: in_fee_detail.MXXMLB = "麻醉"; break;
                            case 4: in_fee_detail.MXXMLB = "膳食"; break;
                            case 5: in_fee_detail.MXXMLB = "输血"; break;
                            case 6: in_fee_detail.MXXMLB = "护理"; break;
                            case 7: in_fee_detail.MXXMLB = "床位"; break;
                            case 8: in_fee_detail.MXXMLB = "检查"; break;
                            case 9: in_fee_detail.MXXMLB = "检验"; break;
                            case 10: in_fee_detail.MXXMLB = "输液"; break;
                            case 11: in_fee_detail.MXXMLB = "材料"; break;
                            case 12: in_fee_detail.MXXMLB = "挂号"; break;
                            case 13: in_fee_detail.MXXMLB = "诊疗"; break;
                            case 14: in_fee_detail.MXXMLB = "其他"; break;
 
                        }
                    }

                    #endregion

                    #region 明细项目名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        in_fee_detail.MXXMMC = "不明";
                    }
                    else
                    {
                        in_fee_detail.MXXMMC = dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 明细项目单位
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_009"]))
                    {
                        in_fee_detail.MXXMDW = "不明";
                    }
                    else
                    {
                        in_fee_detail.MXXMDW = dta.Rows[i]["c_str_009"].ToString();
                    }
                    #endregion

                    #region 明细项目规格
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        in_fee_detail.MXXMGG = "不明";
                    }
                    else
                    {
                        in_fee_detail.MXXMGG = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 明细项目系数
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_005"]))
                    {
                        in_fee_detail.MXXMXS = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMXS = Convert.ToDecimal(dta.Rows[i]["c_float_005"]);
                    }
                    #endregion

                    #region 明细项目数量
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_006"]))
                    {
                        in_fee_detail.MXXMSL = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMSL = Convert.ToDecimal(dta.Rows[i]["c_float_006"]);
                    }
                    #endregion

                    #region 明细项目单价
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_001"]))
                    {
                        in_fee_detail.MXXMDJ = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMDJ = Convert.ToDecimal(dta.Rows[i]["c_float_001"]);
                    }
                    #endregion

                    #region 明细项目医保范围外自费金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_009"]))
                    {
                        in_fee_detail.MXXMZFW = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMZFW = Convert.ToDecimal(dta.Rows[i]["c_float_009"]);	
                    }
                    #endregion

                    #region 明细项目医保范围内分类自费金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_010"]))
                    {
                        in_fee_detail.MXXMZFN = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMZFN = Convert.ToDecimal(dta.Rows[i]["c_float_010"]);
                    }
                    #endregion

                    #region 明细项目金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_004"]))
                    {
                        in_fee_detail.MXXMJE = 0;
                    }
                    else
                    {
                        in_fee_detail.MXXMJE = Convert.ToDecimal(dta.Rows[i]["c_float_004"]);
                    }
                    #endregion
                    
                    #region 优惠价
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_000"]))
                    {
                        in_fee_detail.YHJ = 0;
                    }
                    else
                    {
                        in_fee_detail.YHJ = Convert.ToDecimal(dta.Rows[i]["c_float_000"]);
                    }
                    #endregion
                    
                    #region 自费价
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_003"]))
                    {
                        in_fee_detail.ZFJ = 0;
                    }
                    else
                    {
                        in_fee_detail.ZFJ = Convert.ToDecimal(dta.Rows[i]["c_float_003"]);
                    }
                    #endregion
                    
                    #region 费用记录来源
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        in_fee_detail.FYJLLY = "不明";
                    }
                    else if(dta.Rows[i]["c_int_000"].ToString() == "1")
                    {
                        in_fee_detail.FYJLLY = "临时医嘱";
                    }
                    else if(dta.Rows[i]["c_int_000"].ToString() == "2")
                    {
                        in_fee_detail.FYJLLY = "长期医嘱";
                    }
                    else if(dta.Rows[i]["c_int_000"].ToString() == "3")
                    {
                        in_fee_detail.FYJLLY = "补记帐";
                    }
                    else if(dta.Rows[i]["c_int_000"].ToString() == "4")
                    {
                        in_fee_detail.FYJLLY = "收费处录入";
                    }
                    #endregion
                   
                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        in_fee_detail.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        in_fee_detail.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    in_fee_detail.XGBZ = 0;
                    in_fee_detail.YLYL1 = null;
                    in_fee_detail.YLYL2 = null;
                    #endregion
                    
                    #endregion


                    list.Add(in_fee_detail);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将结算费别表存入数据库
        /// </summary>
        public void Settle_Fee_Type_TransByDB()
        {
            Settle_Fee_TypeAccess access = new Settle_Fee_TypeAccess();
            List<Settle_Fee_Type> list = new List<Settle_Fee_Type>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "Settle_Fee_Type"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getSettle_Fee_Type_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getSettle_Fee_Type_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    Settle_Fee_Type settle_fee_type = new Settle_Fee_Type();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 结算费别ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_003"]))
                    {
                        settle_fee_type.JSFBID = "不明";
                    }
		            else
                    {
                        settle_fee_type.JSFBID = dta.Rows[i]["c_str_003"].ToString();
                    }
                    #endregion

                    #region 结算收据号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        settle_fee_type.JSSJH = "不明";
                    }
		            else
                    {
                        settle_fee_type.JSSJH = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 病人ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        settle_fee_type.PatientID = 0;
                    }
                    else
                    {
                        settle_fee_type.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_004"]);
                    }
                    #endregion

                    #region 门诊住院标志
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                    {
                        settle_fee_type.MZBZ = "不明";
                    }
                    else if(dta.Rows[i]["c_int_001"].ToString() == "0")
                    {
                        settle_fee_type.MZBZ = 	"门诊";
                    }
                    else if(dta.Rows[i]["c_int_001"].ToString() == "1")
                    {
                        settle_fee_type.MZBZ = 	"住院";
                    }
                    #endregion

                    #region 明细费用类别编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        settle_fee_type.MXFYLBBM = 0;
                    }
                    else
                    {
                        settle_fee_type.MXFYLBBM = Convert.ToInt32(dta.Rows[i]["c_int_002"]);
                    }
                    #endregion

                    #region 明细费用类别名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        settle_fee_type.MXFYLBMC = "不明";
                    }
                    else
                    {
                        settle_fee_type.MXFYLBMC = dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 医保负担部分
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_003"]))
                    {
                        settle_fee_type.YBFDBF = 0;
                    }
                    else
                    {
                        settle_fee_type.YBFDBF = Convert.ToDecimal(dta.Rows[i]["c_float_003"]);
                    }
                    #endregion

                    #region 医保自费部分
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_004"]))
                    {
                        settle_fee_type.YBZFBF = 0;
                    }
                    else
                    {
                        settle_fee_type.YBZFBF = Convert.ToDecimal(dta.Rows[i]["c_float_004"]);
                    }		
                    #endregion

                    #region 优惠金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_001"]))
                    {
                        settle_fee_type.YHJE = 0;
                    }
                    else
                    {
                        settle_fee_type.YHJE = Convert.ToDecimal(dta.Rows[i]["c_float_001"]);
                    }
                    #endregion

                    #region 自费金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_002"]))
                    {
                        settle_fee_type.ZFJE = 0;
                    }
                    else
                    {
                        settle_fee_type.ZFJE = Convert.ToDecimal(dta.Rows[i]["c_float_002"]);
                    }
                    #endregion

                    #region 总金额
                    if(Convert.IsDBNull(dta.Rows[i]["c_float_000"]))
                    {
                        settle_fee_type.ZJE = 0;
                    }
                    else
                    {
                        settle_fee_type.ZJE = Convert.ToDecimal(dta.Rows[i]["c_float_000"]);
                    }
                    #endregion

                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        settle_fee_type.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        settle_fee_type.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    settle_fee_type.XGBZ = 0;
                    settle_fee_type.YLYL1 = null;
                    settle_fee_type.YLYL2 = null;
                    #endregion
                    #endregion
                    list.Add(settle_fee_type);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }



        /// <summary>
        /// 从GetDB的DataTable将检验报告单存入数据库
        /// </summary>
        public void LIS_Report_TransByDB()
        {
            LIS_ReportAccess access = new LIS_ReportAccess();
            List<LIS_Report> list = new List<LIS_Report>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "LIS_Report"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getLIS_Report_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getLIS_Report_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    LIS_Report lis_report = new LIS_Report();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 医疗机构代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_018"]))
                    {
                        lis_report.YLJGDM = "不明";
                    }
                    else
                    {
                        lis_report.YLJGDM = dta.Rows[i]["c_str_018"].ToString();		
                    }
                    #endregion

                    #region 报告单ID
                    
                    #endregion

                    #region 检验报告单号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_012"]))
                    {
                        lis_report.BGDH	= "不明";
                    }
                    else
                    {
                        lis_report.BGDH	= dta.Rows[i]["c_str_012"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_031"]))
                    {
                        lis_report.JZLSH = 0;
                    }
                    else
                    {
                        lis_report.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_031"]);
                    }
                    #endregion

                    #region 病人ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_016"]))
                    {
                        lis_report.PatientID = 0;
                    }
                    else
                    {
                        lis_report.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_016"]);	
                    }
                    #endregion

                    #region 卡类型
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_034"]))
                        {
                            lis_report.KLX = "不明";
                        }
                        else if (dta.Rows[i]["c_int_034"].ToString() == "0")
                        {
                            lis_report.KLX = "社保卡";
                        }
                        else if (dta.Rows[i]["c_int_034"].ToString() == "1")
                        {
                            lis_report.KLX = "医保卡";
                        }
                        else if (dta.Rows[i]["c_int_034"].ToString() == "2")
                        {
                            lis_report.KLX = "医联卡";
                        }
                        else if (dta.Rows[i]["c_int_034"].ToString() == "3")
                        {
                            lis_report.KLX = "医院就医卡";
                        }
                        else if (dta.Rows[i]["c_int_034"].ToString() == "9")
                        {
                            lis_report.KLX = "其他";
                        }                       
                    #endregion

                    #region 卡号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_019"]))
                    {
                        lis_report.KH = "不明";
                    }
                    else
                    {
                        lis_report.KH = dta.Rows[i]["c_str_019"].ToString();		
                    }
                    #endregion

                    #region 病人姓名
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        lis_report.BRXM	= "不明";
                    }
                    else
                    {
                        lis_report.BRXM	= dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion

                    #region 病人性别
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_011"]))
                    {
                        lis_report.BRXB = "不明";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "0")
                    {
                        lis_report.BRXB = "未知的性别";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "1")
                    {
                        lis_report.BRXB = "男";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "2")
                    {
                        lis_report.BRXB = "女";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "9")
                    {
                        lis_report.BRXB = "未说明的性别";
                    }
                    #endregion

                    #region 病人年龄
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_013"]))
                    {
                        lis_report.BRNL	= 0;
                    }
                    else
                    {
                        lis_report.BRNL	= Convert.ToInt32(dta.Rows[i]["c_int_013"]);
                    }
                    #endregion

                    #region 床号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_010"]))
                    {
                        lis_report.CH = "不明";
                    }
                    else
                    {
                        lis_report.CH = dta.Rows[i]["c_str_010"].ToString();
                    }
                    #endregion

                    #region 科室代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_023"]))
                    {
                        lis_report.KSDM = 0;
                    }
                    else
                    {
                        lis_report.KSDM = Convert.ToInt32(dta.Rows[i]["c_int_023"]);
                    }
                    #endregion

                    #region 申请科室编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        lis_report.SQKSBM = 0;
                    }
                    else
                    {
                        lis_report.SQKSBM = Convert.ToInt32(dta.Rows[i]["c_int_002"]);		
                    }
                    #endregion

                    #region 申请科室名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_014"]))
                    {
                        lis_report.SQKSMC = "不明";
                    }
                    else
                    {
                        lis_report.SQKSMC = dta.Rows[i]["c_str_014"].ToString();
                    }
                    #endregion

                    #region 检验项目分类代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_033"]))
                    {
                        lis_report.JYXMFLDM	= "不明";
                    }
                    else if(dta.Rows[i]["c_int_033"].ToString() == "13")
                    {
                        lis_report.JYXMFLDM	= "血液化学";
                    }
                    else if(dta.Rows[i]["c_int_033"].ToString() == "14")
                    {
                        lis_report.JYXMFLDM	= "临床免疫学";
                    }
                    else if(dta.Rows[i]["c_int_033"].ToString() == "15")
                    {
                        lis_report.JYXMFLDM	= "临床血液生物物理化学";
                    }
                    else if(dta.Rows[i]["c_int_033"].ToString() == "16")
                    {
                        lis_report.JYXMFLDM	= "临床微生物";
                    }
                    else if(dta.Rows[i]["c_int_033"].ToString() == "17")
                    {
                        lis_report.JYXMFLDM	= "尿液";
                    }
                    else if(dta.Rows[i]["c_int_033"].ToString() == "18")
                    {
                        lis_report.JYXMFLDM	= "其它";
                    }
                    #endregion

                    #region 标本种类
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_003"]))
                    {
                        lis_report.BBZL = 0;
                    }
                    else
                    {
                        lis_report.BBZL = Convert.ToInt32(dta.Rows[i]["c_int_003"]);
                    }
                    #endregion

                    #region 标本代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_005"]))
                    {
                        lis_report.BBDM	= "不明";
                    }
                    else
                    {
                        lis_report.BBDM	= dta.Rows[i]["c_str_005"].ToString();
                    }
                    #endregion

                    #region 报告单类别编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_035"]))
                    {
                        lis_report.BGDLBBM = "不明";
                    }
                    else
                    {
                        lis_report.BGDLBBM = dta.Rows[i]["c_str_035"].ToString();
                    }
                    #endregion

                    #region 报告单类别
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_034"]))
                    {
                        lis_report.BGDLB = "不明";
                    }
                    else
                    {
                        lis_report.BGDLB = dta.Rows[i]["c_str_034"].ToString();	
                    }
                    #endregion

                    #region 申请来源
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_019"]))
                    {
                        lis_report.SQLY	= "不明";
                    }
                    else if(dta.Rows[i]["c_int_019"].ToString() == "1")
                    {
                        lis_report.SQLY	= "门诊";
                    }
                    else if(dta.Rows[i]["c_int_019"].ToString() == "2")
                    {
                        lis_report.SQLY	= "住院";
                    }
                    else if(dta.Rows[i]["c_int_019"].ToString() == "3")
                    {
                        lis_report.SQLY	= "急诊";
                    }
                    else if(dta.Rows[i]["c_int_019"].ToString() == "9")
                    {
                        lis_report.SQLY	= "其他";
                    }
                    #endregion

                    #region 申请人姓名（工号）
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_008"]))
                    {
                        lis_report.SQRXM = 0;
                    }
                    else
                    {
                        lis_report.SQRXM = Convert.ToInt32(dta.Rows[i]["c_int_008"]);		
                    }
                    #endregion

                    #region 操作人姓名（工号）
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_025"]))
                    {
                        lis_report.CZRXM = 0;
                    }
                    else
                    {
                        lis_report.CZRXM = Convert.ToInt32(dta.Rows[i]["c_int_025"]);		
                    }
                    #endregion

                    #region 报告人姓名（工号）
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_027"]))
                    {
                        lis_report.BGRXM = 0;
                    }
                    else
                    {
                        lis_report.BGRXM = Convert.ToInt32(dta.Rows[i]["c_int_026"]);		
                    }
                    #endregion
                    
                    #region 审核人姓名（工号）
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_027"]))
                    {
                        lis_report.SHRXM = 0;
                    }
                    else
                    {
                        lis_report.SHRXM = Convert.ToInt32(dta.Rows[i]["c_int_026"]);		
                    }
                    #endregion
                    
                    #region 报告日期
                    if(Convert.IsDBNull(dta.Rows[i]["c_date_005"]))
                    {
                        lis_report.BGRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_report.BGRQ = Convert.ToDateTime(dta.Rows[i]["c_date_005"]);		
                    }
                    #endregion

                    #region 打印日期
                    if(Convert.IsDBNull(dta.Rows[i]["c_date_006"]))
                    {
                        lis_report.DYRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_report.DYRQ = Convert.ToDateTime(dta.Rows[i]["c_date_006"]);		
                    }
                    #endregion
                    
                    #region 申请日期
                    if(Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        lis_report.SQRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_report.SQRQ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);		
                    }
                    #endregion
                    
                    #region 采集日期
                    if(Convert.IsDBNull(dta.Rows[i]["c_date_009"]))
                    {
                        lis_report.CJRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_report.CJRQ = Convert.ToDateTime(dta.Rows[i]["c_date_009"]);		
                    }
                    #endregion
                    
                    #region 检验日期
                    if(Convert.IsDBNull(dta.Rows[i]["c_date_007"]))
                    {
                        lis_report.JYRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_report.JYRQ = Convert.ToDateTime(dta.Rows[i]["c_date_007"]);		
                    }
                    #endregion

                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        lis_report.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_report.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    lis_report.XGBZ = 0;
                    lis_report.YLYL1 = null;
                    lis_report.YLYL2 = null;
                    #endregion
                  
                    #endregion

                    list.Add(lis_report);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将检验指标表存入数据库
        /// </summary>
        public void LIS_Indicators_TransByDB()
        {
            LIS_IndicatorsAccess access = new LIS_IndicatorsAccess();
            List<LIS_Indicators> list = new List<LIS_Indicators>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "LIS_Indicators"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getLIS_Indicators_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getLIS_Indicators_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    LIS_Indicators lis_indicator = new LIS_Indicators();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 指标ID
                    	
                    #endregion

                    #region 检验指标流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_008"]))
                    {
                        lis_indicator.JYZBLSH = "不明";
                    }
                    else
                    {
                        lis_indicator.JYZBLSH = dta.Rows[i]["c_str_008"].ToString();
                    }
                    #endregion

                    #region 病人ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_008"]))
                    {
                        lis_indicator.PatientID = 0;
                    }
                    else
                    {
                        lis_indicator.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_008"]);
                    }
                    #endregion

                    #region 就诊流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        lis_indicator.JZLSH	= 0;
                    }
                    else
                    {
                        lis_indicator.JZLSH	= Convert.ToInt32(dta.Rows[i]["c_int_009"]);
                    }
                    #endregion

                    #region 报告单号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_013"]))
                    {
                        lis_indicator.BGDH = "不明";
                    }
                    else
                    {
                        lis_indicator.BGDH = dta.Rows[i]["c_str_013"].ToString();
                    }
                    #endregion

                    #region 检测指标代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        lis_indicator.JCZBDM = 0;
                    }
                    else
                    {
                        lis_indicator.JCZBDM = Convert.ToInt32(dta.Rows[i]["c_int_004"]);
                    }
                    #endregion

                    #region 检测指标名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        lis_indicator.JCZBMC = "不明";
                    }
                    else
                    {
                        lis_indicator.JCZBMC = dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 检测指标结果
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        lis_indicator.JCZBJG = "不明";
                    }
                    else
                    {
                        lis_indicator.JCZBJG = dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion

                    #region 通道号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_003"]))
                    {
                        lis_indicator.TDH = "不明";
                    }
                    else
                    {
                        lis_indicator.TDH = dta.Rows[i]["c_str_003"].ToString();
                    }
                    #endregion

                    #region 参考值范围下限
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_007"]))
                    {
                        lis_indicator.CKZXX	= "不明";
                    }
                    else
                    {
                        lis_indicator.CKZXX	= dta.Rows[i]["c_str_007"].ToString();
                    }
                    #endregion

                    #region 参考值范围上限
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        lis_indicator.CKZSX	=  "不明";
                    }
                    else
                    {
                        lis_indicator.CKZSX	= dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion

                    #region 当前结果
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_005"]))
                    {
                        lis_indicator.DQJG = "不明";
                    }
                    else
                    {
                        lis_indicator.DQJG = dta.Rows[i]["c_str_005"].ToString();
                    }
                    #endregion

                    #region 异常提示
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_006"]))
                    {
                        lis_indicator.YCTS = 0;
                    }
                    else
                    {
                        lis_indicator.YCTS = Convert.ToInt32(dta.Rows[i]["c_int_006"]);	
                    }
                    #endregion

                    #region 说明
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        lis_indicator.SM = "不明";
                    }
                    else
                    {
                        lis_indicator.SM = dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion

                    #region 剂量单位
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_010"]))
                    {
                        lis_indicator.JLDW = "不明";
                    }
                    else
                    {
                        lis_indicator.JLDW = dta.Rows[i]["c_str_010"].ToString();
                    }
                    #endregion

                    #region 数据来源
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_010"]))
                    {
                        lis_indicator.SJLY = 0;
                    }
                    else
                    {
                        lis_indicator.SJLY = Convert.ToInt32(dta.Rows[i]["c_int_010"]);	
                    }
                    #endregion

                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        lis_indicator.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        lis_indicator.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    lis_indicator.XGBZ = 0;
                    lis_indicator.YLYL1 = null;
                    lis_indicator.YLYL2 = null;
                    #endregion
                   
                    #endregion

                    list.Add(lis_indicator);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }


        /// <summary>
        /// 从GetDB的DataTable将住院病历主表存入数据库
        /// </summary>
        public void CIS_Main_TransByDB()
        {
            CIS_MainAccess access = new CIS_MainAccess();
            List<CIS_Main> list = new List<CIS_Main>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "CIS_Main"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getCIS_Main_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getCIS_Main_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    CIS_Main cis_main = new CIS_Main();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 医疗机构代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        cis_main.YLJGDM	= "不明";
                    }
                    else
                    {
                        cis_main.YLJGDM	= dta.Rows[i]["c_str_000"].ToString();
                    }
                    #endregion

                    #region 住院病历ID
                    //cis_main.	ZYBLID
                    #endregion

                    #region 住院号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_020"]))
                    {
                        cis_main.ZYH = "不明";
                    }
                    else
                    {
                        cis_main.ZYH = dta.Rows[i]["c_str_020"].ToString();
                    }
                    #endregion

                    #region 就诊流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_061"]))
                    {
                        cis_main.JZLSH = 0;
                    }
                    else
                    {
                        cis_main.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_061"]);
                    }
                    #endregion
                    
                    #region 病人ID
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_062"]))
                    {
                        cis_main.PatientID = 0;
                    }
                    else
                    {
                        cis_main.PatientID = Convert.ToInt32(dta.Rows[i]["c_int_062"]);
                    }
                    #endregion

                    #region 卡号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_015"]))
                    {
                        cis_main.KH = "不明";
                    }
                    else
                    {
                        cis_main.KH = dta.Rows[i]["c_str_015"].ToString();
                    }
                    #endregion
                  
                    #region 卡类型
                        if (Convert.IsDBNull(dta.Rows[i]["c_int_018"]))
                        {
                            cis_main.KLX = "不明";
                        }
                        else if (dta.Rows[i]["c_int_018"].ToString() == "0")
                        {
                            cis_main.KLX = "社保卡";
                        }
                        else if (dta.Rows[i]["c_int_018"].ToString() == "1")
                        {
                            cis_main.KLX = "医保卡";
                        }
                        else if (dta.Rows[i]["c_int_018"].ToString() == "2")
                        {
                            cis_main.KLX = "医联卡";
                        }
                        else if (dta.Rows[i]["c_int_018"].ToString() == "3")
                        {
                            cis_main.KLX = "医院就医卡";
                        }
                        else if (dta.Rows[i]["c_int_018"].ToString() == "9")
                        {
                            cis_main.KLX = "其他";
                        }                       
                    #endregion
                    
                    #region 病案号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_001"]))
                    {
                        cis_main.BAH = "不明";
                    }
                    else
                    {
                        cis_main.BAH = dta.Rows[i]["c_str_001"].ToString();
                    }
                    #endregion
                    
                    #region 病理号
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_014"]))
                    {
                        cis_main.BLH = "不明";
                    }
                    else
                    {
                        cis_main.BLH = dta.Rows[i]["c_str_014"].ToString();
                    }
                    #endregion
                    
                    #region 住院次数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                    {
                        cis_main.ZYCS = 0;
                    }
                    else
                    {
                        cis_main.ZYCS = Convert.ToInt32(dta.Rows[i]["c_int_001"]);
                    }
                    #endregion
                    
                    #region 入院类型
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_004"]))
                    {
                        cis_main.RYLX = "不明";
                    }
                    else if(dta.Rows[i]["c_int_004"].ToString() == "1")
                    {
                        cis_main.RYLX = "门诊转入";
                    }
                    else if(dta.Rows[i]["c_int_004"].ToString() == "2")
                    {
                        cis_main.RYLX = "急诊转入";
                    }
                    else if(dta.Rows[i]["c_int_004"].ToString() == "3")
                    {
                        cis_main.RYLX = "他院转入";
                    }
                    else if(dta.Rows[i]["c_int_004"].ToString() == "4")
                    {
                        cis_main.RYLX = "急观转入";
                    }
                    else if(dta.Rows[i]["c_int_004"].ToString() == "9")
                    {
                        cis_main.RYLX = "其他";
                    }
                    #endregion
                    
                    #region 确诊天数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_005"]))
                    {
                        cis_main.QZTS = 0;
                    }
                    else
                    {
                        cis_main.QZTS = Convert.ToInt32(dta.Rows[i]["c_int_005"]);
                    }
                    #endregion
                    
                    #region 术后天数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_017"]))
                    {
                        cis_main.SHTS = 0;
                    }
                    else
                    {
                        cis_main.SHTS = Convert.ToInt32(dta.Rows[i]["c_int_017"]);
                    }
                    #endregion
                    
                    #region 实际住院天数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_049"]))
                    {
                        cis_main.SJZYTS = 0;
                    }
                    else
                    {
                        cis_main.SJZYTS = Convert.ToInt32(dta.Rows[i]["c_int_049"]);
                    }
                    #endregion
                    
                    #region 出院方式
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        cis_main.CYFS = "不明";
                    }
                    else if (dta.Rows[i]["c_int_002"].ToString() == "1")
                    {
                        cis_main.CYFS = "治愈";
                    }
                    else if (dta.Rows[i]["c_int_002"].ToString() == "2")
                    {
                        cis_main.CYFS = "好转";
                    }
                    else if (dta.Rows[i]["c_int_002"].ToString() == "3")
                    {
                        cis_main.CYFS = "未愈";
                    }
                    else if (dta.Rows[i]["c_int_002"].ToString() == "4")
                    {
                        cis_main.CYFS = "死亡";
                    }
                    else if (dta.Rows[i]["c_int_002"].ToString() == "5")
                    {
                        cis_main.CYFS = "转院";
                    }
                    else if (dta.Rows[i]["c_int_002"].ToString() == "9")
                    {
                        cis_main.CYFS = "其他";
                    }
                    #endregion

                    #region 治疗类别
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_048"]))
                    {
                        cis_main.ZLLB = "不明";
                    }
                    else if (dta.Rows[i]["c_int_048"].ToString() == "1")
                    {
                        cis_main.ZLLB = "西医";
                    }
                    else if (dta.Rows[i]["c_int_048"].ToString() == "2")
                    {
                        cis_main.ZLLB = "中医";
                    }
                    else if (dta.Rows[i]["c_int_048"].ToString() == "3")
                    {
                        cis_main.ZLLB = "中西医";
                    }                    
                    #endregion
                    
                    #region 手术标志
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_011"]))
                    {
                        cis_main.SSBZ = "不明";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "0")
                    {
                        cis_main.SSBZ = "非手术";
                    }
                    else if (dta.Rows[i]["c_int_011"].ToString() == "1")
                    {
                        cis_main.SSBZ = "手术";
                    }
                    #endregion
                    
                    #region 首次手术标志
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_013"]))
                    {
                        cis_main.SCSSBZ = "不明";
                    }
                    else if (dta.Rows[i]["c_int_013"].ToString() == "0")
                    {
                        cis_main.SCSSBZ = "否";
                    }
                    else if (dta.Rows[i]["c_int_013"].ToString() == "1")
                    {
                        cis_main.SCSSBZ = "是";
                    }
                    #endregion
                    
                    #region 入院病区
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_003"]))
                    {
                        cis_main.RYBQ	= "不明";
                    }
                    else
                    {
                        cis_main.RYBQ	= dta.Rows[i]["c_str_003"].ToString();
                    }
                    #endregion
                    
                    #region 出院病区
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_044"]))
                    {
                        cis_main.CYBQ	= "不明";
                    }
                    else
                    {
                        cis_main.CYBQ	= dta.Rows[i]["c_str_044"].ToString();
                    }
                    #endregion
                    
                    #region 入院科室编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_066"]))
                    {
                        cis_main.RYKSBM = 0;
                    }
                    else
                    {
                        cis_main.RYKSBM = Convert.ToInt32(dta.Rows[i]["c_int_066"]);
                    }
                    #endregion

                    #region 入院科室名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_002"]))
                    {
                        cis_main.RYKSMC	= "不明";
                    }
                    else
                    {
                        cis_main.RYKSMC	= dta.Rows[i]["c_str_002"].ToString();
                    }
                    #endregion
                    
                    #region 转科科室1
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        cis_main.ZKKS1	= "不明";
                    }
                    else
                    {
                        cis_main.ZKKS1	= dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 转科科室2
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_005"]))
                    {
                        cis_main.ZKKS2	= "不明";
                    }
                    else
                    {
                        cis_main.ZKKS2	= dta.Rows[i]["c_str_005"].ToString();
                    }
                    #endregion
                    
                    #region 死亡诊断名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_024"]))
                    {
                        cis_main.SWZDMC	= "不明";
                    }
                    else
                    {
                        cis_main.SWZDMC	= dta.Rows[i]["c_str_024"].ToString();
                    }
                    #endregion
                    
                    #region 院内感染次数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_014"]))
                    {
                        cis_main.YNGRCS = 0;
                    }
                    else
                    {
                        cis_main.YNGRCS = Convert.ToInt32(dta.Rows[i]["c_int_014"]);
                    }
                    #endregion
                    
                    #region 院内感染结果编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_012"]))
                    {
                        cis_main.YNGRJGBM	= "不明";
                    }
                    else
                    {
                        cis_main.YNGRJGBM	= dta.Rows[i]["c_str_012"].ToString();
                    }
                    #endregion
                    
                    #region 院内感染名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        cis_main.YNGRMC	= "不明";
                    }
                    else
                    {
                        cis_main.YNGRMC	= dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion
                    
                    #region 并发症标志
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_015"]))
                    {
                        cis_main.BFZBZ = "不明";
                    }
                    else if (dta.Rows[i]["c_int_015"].ToString() == "0")
                    {
                        cis_main.BFZBZ = "无";
                    }
                    else if (dta.Rows[i]["c_int_015"].ToString() == "1")
                    {
                        cis_main.BFZBZ = "有";
                    }
                    #endregion
                    
                    #region 自制中药制剂
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_019"]))
                    {
                        cis_main.ZZZYZJ = "不明";
                    }
                    else if (dta.Rows[i]["c_int_019"].ToString() == "0")
                    {
                        cis_main.ZZZYZJ = "否";
                    }
                    else if (dta.Rows[i]["c_int_019"].ToString() == "1")
                    {
                        cis_main.ZZZYZJ = "是";
                    }
                    #endregion
                    
                    #region 抢救次数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_025"]))
                    {
                        cis_main.QJCS = 0;
                    }
                    else
                    {
                        cis_main.QJCS = Convert.ToInt32(dta.Rows[i]["c_int_025"]);
                    }
                    #endregion
                    
                    #region 抢救类型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_023"]))
                    {
                        cis_main.QJLX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_023"].ToString() == "1")
                    {
                        cis_main.QJLX = "西医";
                    }
                    else if (dta.Rows[i]["c_int_023"].ToString() == "2")
                    {
                        cis_main.QJLX = "中医";
                    }
                    else if (dta.Rows[i]["c_int_023"].ToString() == "3")
                    {
                        cis_main.QJLX = "中西医";
                    }                    
                    #endregion
                    
                    #region 抢救成功次数
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_024"]))
                    {
                        cis_main.QJCGCS = 0;
                    }
                    else
                    {
                        cis_main.QJCGCS = Convert.ToInt32(dta.Rows[i]["c_int_024"]);
                    }
                    #endregion
                    
                    #region 出院科室编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_069"]))
                    {
                        cis_main.CYKSBM = 0;
                    }
                    else
                    {
                        cis_main.CYKSBM = Convert.ToInt32(dta.Rows[i]["c_int_069"]);
                    }
                    #endregion
                    
                    #region 出院科室名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_043"]))
                    {
                        cis_main.CYKSMC	= "不明";
                    }
                    else
                    {
                        cis_main.CYKSMC	= dta.Rows[i]["c_str_043"].ToString();
                    }
                    #endregion
                    
                    #region 门诊第一诊断编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_056"]))
                    {
                        cis_main.MZDYZDBM = "不明";
                    }
                    else
                    {
                        cis_main.MZDYZDBM = dta.Rows[i]["c_str_056"].ToString();
                    }
                    #endregion
                    
                    #region 门诊第一诊断名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_055"]))
                    {
                        cis_main.MZDYZDMC	= "不明";
                    }
                    else
                    {
                        cis_main.MZDYZDMC	= dta.Rows[i]["c_str_055"].ToString();
                    }
                    #endregion

                    #region 入院第一诊断编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_049"]))
                    {
                        cis_main.RYDYZDBM = "不明";
                    }
                    else
                    {
                        cis_main.RYDYZDBM = dta.Rows[i]["c_str_049"].ToString();
                    }
                    #endregion
                    
                    #region 入院第一诊断名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_048"]))
                    {
                        cis_main.RYDYZDMC	= "不明";
                    }
                    else
                    {
                        cis_main.RYDYZDMC	= dta.Rows[i]["c_str_048"].ToString();
                    }
                    #endregion
                    
                    #region 出院第一诊断编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_052"]))
                    {
                        cis_main.CYDYZDBM = "不明";
                    }
                    else
                    {
                        cis_main.CYDYZDBM = dta.Rows[i]["c_str_052"].ToString();
                    }
                    #endregion
                    
                    #region 出院第一诊断名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_050"]))
                    {
                        cis_main.CYDYZDMC	= "不明";
                    }
                    else
                    {
                        cis_main.CYDYZDMC	= dta.Rows[i]["c_str_050"].ToString();
                    }
                    #endregion
                    
                    #region 门诊出院诊断符合编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_021"]))
                    {
                        cis_main.MZCYZD = "不明";
                    }
                    else if (dta.Rows[i]["c_int_021"].ToString() == "0")
                    {
                        cis_main.MZCYZD = "";
                    }
                    else if (dta.Rows[i]["c_int_021"].ToString() == "1")
                    {
                        cis_main.MZCYZD = "符合";
                    }
                    #endregion
                    
                    #region 入院出院诊断符合编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_008"]))
                    {
                        cis_main.RYCYZD = "不明";
                    }
                    else if (dta.Rows[i]["c_int_008"].ToString() == "0")
                    {
                        cis_main.RYCYZD = "";
                    }
                    else if (dta.Rows[i]["c_int_008"].ToString() == "1")
                    {
                        cis_main.RYCYZD = "符合";
                    }
                    #endregion
                    
                    #region 术前术后诊断符合编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_007"]))
                    {
                        cis_main.SQSHZD = "不明";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "0")
                    {
                        cis_main.SQSHZD = "";
                    }
                    else if (dta.Rows[i]["c_int_007"].ToString() == "1")
                    {
                        cis_main.SQSHZD = "符合";
                    }
                    #endregion
                    
                    #region 临床病理诊断符合编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_009"]))
                    {
                        cis_main.LCBLZD = "不明";
                    }
                    else if (dta.Rows[i]["c_int_009"].ToString() == "0")
                    {
                        cis_main.LCBLZD = "";
                    }
                    else if (dta.Rows[i]["c_int_009"].ToString() == "1")
                    {
                        cis_main.LCBLZD = "符合";
                    }
                    #endregion
                    
                    #region 放射病理诊断符合编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_006"]))
                    {
                        cis_main.FSBLZD = "不明";
                    }
                    else if (dta.Rows[i]["c_int_006"].ToString() == "0")
                    {
                        cis_main.FSBLZD = "";
                    }
                    else if (dta.Rows[i]["c_int_006"].ToString() == "1")
                    {
                        cis_main.FSBLZD = "符合";
                    }
                    #endregion
                    
                    #region 损伤中毒的外部因素
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_019"]))
                    {
                        cis_main.SSZD = "不明";
                    }
                    else if (dta.Rows[i]["c_str_019"].ToString() == "0")
                    {
                        cis_main.SSZD = "否";
                    }
                    else if (dta.Rows[i]["c_str_019"].ToString() == "1")
                    {
                        cis_main.SSZD = "是";
                    }
                    #endregion
                    
                    #region 药物过敏
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_013"]))
                    {
                        cis_main.YWGM	= "不明";
                    }
                    else
                    {
                        cis_main.YWGM	= dta.Rows[i]["c_str_013"].ToString();
                    }
                    #endregion
                    
                    #region HBSAG 检查结果编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_022"]))
                    {
                        cis_main.HBSAG_JG = "不明";
                    }
                    else if (dta.Rows[i]["c_int_022"].ToString() == "0")
                    {
                        cis_main.HBSAG_JG = "未查";
                    }
                    else if (dta.Rows[i]["c_int_022"].ToString() == "1")
                    {
                        cis_main.HBSAG_JG = "阴性";
                    }
                    else if (dta.Rows[i]["c_int_022"].ToString() == "2")
                    {
                        cis_main.HBSAG_JG = "阳性";
                    }                    
                    #endregion

                    #region HCVab 检查结果编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_047"]))
                    {
                        cis_main.HCVab_JG = "不明";
                    }
                    else if (dta.Rows[i]["c_int_047"].ToString() == "0")
                    {
                        cis_main.HCVab_JG = "未查";
                    }
                    else if (dta.Rows[i]["c_int_047"].ToString() == "1")
                    {
                        cis_main.HCVab_JG = "阴性";
                    }
                    else if (dta.Rows[i]["c_int_047"].ToString() == "2")
                    {
                        cis_main.HCVab_JG = "阳性";
                    }                    
                    #endregion
                    
                    #region HIVab 检查结果编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_012"]))
                    {
                        cis_main.HIVab_JG = "不明";
                    }
                    else if (dta.Rows[i]["c_int_012"].ToString() == "0")
                    {
                        cis_main.HIVab_JG = "未查";
                    }
                    else if (dta.Rows[i]["c_int_012"].ToString() == "1")
                    {
                        cis_main.HIVab_JG = "阴性";
                    }
                    else if (dta.Rows[i]["c_int_012"].ToString() == "2")
                    {
                        cis_main.HIVab_JG = "阳性";
                    }                    
                    #endregion
                    
                    #region 手术治疗检查诊断为本院第一例
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_046"]))
                    {
                        cis_main.SSDYL = "不明";
                    }
                    else if (dta.Rows[i]["c_int_046"].ToString() == "0")
                    {
                        cis_main.SSDYL = "否";
                    }
                    else if (dta.Rows[i]["c_int_046"].ToString() == "1")
                    {
                        cis_main.SSDYL = "是";
                    }
                    #endregion                   

                    #region Rh血型
                    if (Convert.IsDBNull(dta.Rows[i]["c_int_000"]))
                    {
                        cis_main.XX = "不明";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "1")
                    {
                        cis_main.XX = "RH阳性";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "2")
                    {
                        cis_main.XX = "RH阴性";
                    }
                    else if (dta.Rows[i]["c_int_000"].ToString() == "9")
                    {
                        cis_main.XX = "血型不详";
                    }
                    #endregion
                    
                    #region 红细胞输血量
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_033"]))
                    {
                        cis_main.HXBSXL = 0;
                    }
                    else
                    {
                        cis_main.HXBSXL = Convert.ToInt32(dta.Rows[i]["c_int_033"]);
                    }
                    #endregion

                    #region 血小板输血量
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_029"]))
                    {
                        cis_main.XXBSXL = 0;
                    }
                    else
                    {
                        cis_main.XXBSXL = Convert.ToInt32(dta.Rows[i]["c_int_029"]);
                    }
                    #endregion
                    
                    #region 血浆输血量
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_032"]))
                    {
                        cis_main.XJSXL = 0;
                    }
                    else
                    {
                        cis_main.XJSXL = Convert.ToInt32(dta.Rows[i]["c_int_032"]);
                    }
                    #endregion
                    
                    #region 全血输血量
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_030"]))
                    {
                        cis_main.QXSXL = 0;
                    }
                    else
                    {
                        cis_main.QXSXL = Convert.ToInt32(dta.Rows[i]["c_int_030"]);
                    }
                    #endregion
                    
                    #region 其他输血量
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_031"]))
                    {
                        cis_main.QTSXL = 0;
                    }
                    else
                    {
                        cis_main.QTSXL = Convert.ToInt32(dta.Rows[i]["c_int_031"]);
                    }
                    #endregion
                    
                    #region 输血反应
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_025"]))
                    {
                        cis_main.SXFY = "不明";
                    }
                    else if (dta.Rows[i]["c_str_025"].ToString() == "0")
                    {
                        cis_main.SXFY = "无";
                    }
                    else if (dta.Rows[i]["c_str_025"].ToString() == "1")
                    {
                        cis_main.SXFY = "有";
                    }
                    #endregion   
                    
                    #region 传染病报告
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_026"]))
                    {
                        cis_main.CRBBG = "不明";
                    }
                    else
                    {
                        cis_main.CRBBG = dta.Rows[i]["c_str_026"].ToString();
                    }
                    
                    #endregion
                    
                    #region 主任医师姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_038"]))
                    {
                        cis_main.ZRYSXM = "不明";
                    }
                    else
                    {
                        cis_main.ZRYSXM = dta.Rows[i]["c_str_038"].ToString();
                    }                    
                    #endregion

                    #region 主治医师姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_039"]))
                    {
                        cis_main.ZZYSXM = "不明";
                    }
                    else
                    {
                        cis_main.ZZYSXM = dta.Rows[i]["c_str_039"].ToString();
                    }                    
                    #endregion
                    
                    #region 住院医师姓名
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_040"]))
                    {
                        cis_main.ZYYSXM = "不明";
                    }
                    else
                    {
                        cis_main.ZYYSXM = dta.Rows[i]["c_str_040"].ToString();
                    }                    
                    #endregion
                    
                    #region 手术费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_002"]))
                    {
                        cis_main.SSF = 0;
                    }
                    else
                    {
                        cis_main.SSF = Convert.ToDecimal(dta.Rows[i]["c_float_002"]);
                    }                    
                    #endregion
                    
                    #region 化验费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_003"]))
                    {
                        cis_main.HYF = 0;
                    }
                    else
                    {
                        cis_main.HYF = Convert.ToDecimal(dta.Rows[i]["c_float_003"]);
                    }                    
                    #endregion

                    #region 输氧费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_005"]))
                    {
                        cis_main.SYF = 0;
                    }
                    else
                    {
                        cis_main.SYF = Convert.ToDecimal(dta.Rows[i]["c_float_005"]);
                    }                    
                    #endregion
                    
                    #region 床位费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_006"]))
                    {
                        cis_main.CWF = 0;
                    }
                    else
                    {
                        cis_main.CWF = Convert.ToDecimal(dta.Rows[i]["c_float_006"]);
                    }                    
                    #endregion

                    #region 自理费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_015"]))
                    {
                        cis_main.ZLF = 0;
                    }
                    else
                    {
                        cis_main.ZLF = Convert.ToDecimal(dta.Rows[i]["c_float_015"]);
                    }                    
                    #endregion
                    
                    #region 陪床费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_016"]))
                    {
                        cis_main.PCF = 0;
                    }
                    else
                    {
                        cis_main.PCF = Convert.ToDecimal(dta.Rows[i]["c_float_016"]);
                    }                    
                    #endregion

                    #region 麻醉费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_017"]))
                    {
                        cis_main.MZF = 0;
                    }
                    else
                    {
                        cis_main.MZF = Convert.ToDecimal(dta.Rows[i]["c_float_017"]);
                    }                    
                    #endregion
                    
                    #region 输血费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_018"]))
                    {
                        cis_main.SXF = 0;
                    }
                    else
                    {
                        cis_main.SXF = Convert.ToDecimal(dta.Rows[i]["c_float_018"]);
                    }                    
                    #endregion

                    #region 西药费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_019"]))
                    {
                        cis_main.XYF = 0;
                    }
                    else
                    {
                        cis_main.XYF = Convert.ToDecimal(dta.Rows[i]["c_float_019"]);
                    }                    
                    #endregion
                    
                    #region 中成药费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_020"]))
                    {
                        cis_main.ZYF = 0;
                    }
                    else
                    {
                        cis_main.ZYF = Convert.ToDecimal(dta.Rows[i]["c_float_020"]);
                    }                    
                    #endregion

                    #region 透视费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_021"]))
                    {
                        cis_main.TSF = 0;
                    }
                    else
                    {
                        cis_main.TSF = Convert.ToDecimal(dta.Rows[i]["c_float_021"]);
                    }                    
                    #endregion
                    
                    #region 中草药费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_022"]))
                    {
                        cis_main.ZCYF = 0;
                    }
                    else
                    {
                        cis_main.ZCYF = Convert.ToDecimal(dta.Rows[i]["c_float_022"]);
                    }                    
                    #endregion
                    
                    #region 检查费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_001"]))
                    {
                        cis_main.JCF = 0;
                    }
                    else
                    {
                        cis_main.JCF = Convert.ToDecimal(dta.Rows[i]["c_float_001"]);
                    }                    
                    #endregion
                    
                    #region 治疗费
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_024"]))
                    {
                        cis_main.ZHLF = 0;
                    }
                    else
                    {
                        cis_main.ZHLF = Convert.ToDecimal(dta.Rows[i]["c_float_024"]);
                    }                    
                    #endregion
                    
                    #region 其他费用
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_008"]))
                    {
                        cis_main.QTFY = 0;
                    }
                    else
                    {
                        cis_main.QTFY = Convert.ToDecimal(dta.Rows[i]["c_float_008"]);
                    }                    
                    #endregion
                    
                    #region 总费用
                    if (Convert.IsDBNull(dta.Rows[i]["c_float_000"]))
                    {
                        cis_main.ZFY = 0;
                    }
                    else
                    {
                        cis_main.ZFY = Convert.ToDecimal(dta.Rows[i]["c_float_000"]);
                    }                    
                    #endregion
                    
                    #region 确诊日期
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        cis_main.QZRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_main.QZRQ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion
                    
                    #region 入院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_007"]))
                    {
                        cis_main.RYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_main.RYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_007"]);
                    }
                    #endregion
                    
                    #region 死亡时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_003"]))
                    {
                        cis_main.SWSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_main.SWSJ = Convert.ToDateTime(dta.Rows[i]["c_date_003"]);
                    }
                    #endregion
                    
                    #region 出院时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_006"]))
                    {
                        cis_main.CYSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_main.CYSJ = Convert.ToDateTime(dta.Rows[i]["c_date_006"]);
                    }
                    #endregion
                    
                    #region 操作日期
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_005"]))
                    {
                        cis_main.CZRQ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_main.CZRQ = Convert.ToDateTime(dta.Rows[i]["c_date_005"]);
                    }
                    #endregion
                    
                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        cis_main.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_main.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    cis_main.XGBZ = 0;
                    cis_main.YLYL1 = null;
                    cis_main.YLYL2 = null;
                    #endregion
                    


                    #endregion

                    list.Add(cis_main);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }



        /// <summary>
        /// 从GetDB的DataTable将住院病历手术明细表存入数据库
        /// </summary>
        public void CIS_Operation_Detail_TransByDB()
        {
            CIS_Operation_DetailAccess access = new CIS_Operation_DetailAccess();
            List<CIS_Operation_Detail> list = new List<CIS_Operation_Detail>();

            GetDB getdb = new GetDB();                                      //调用GetDB类
            DataTable dta = new DataTable();                                //转化为datatatable
            DateTime maxtime = Convert.ToDateTime("2009-07-30 11:52:00");

            DateTime create_time;
            GetNum Num = new GetNum();
            create_time = Num.GetMaxNumber("CJSJ", "CIS_Operation_Detail"); //开始时间
            DateTime end_time = access.Add_Create_Time(create_time);         //结束时间

            bar = new ProBar();
            // bar = new ProBar(create_time);
            // bar.Show();                  //初始化进度条

            for (int j = 0; j < 6; j++)   //循环
            {
                if (j != 0) //若不是第一次取数据，则重新定义开始和结束时间
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                }

                dta = getdb.getCIS_Operation_Detail_DataTable(create_time, access);

                //若这个时间段无数据
                while (dta.Rows.Count == 0)
                {
                    create_time = end_time;
                    end_time = access.Add_Create_Time(create_time);
                    dta = getdb.getCIS_Operation_Detail_DataTable(create_time, access);
                }

                //将dta导入实体Bean中
                for (int i = 0; i < dta.Rows.Count; i++)
                {
                    CIS_Operation_Detail cis_oper_detail = new CIS_Operation_Detail();

                    ///////////////////
                    ///添加属性@@@@
                    ///////////////////
                    #region 表属性填充

                    #region 医疗机构代码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_010"]))
                    {
                        cis_oper_detail.YLJGDM = "不明";
                    }
                    else
                    {
                        cis_oper_detail.YLJGDM = dta.Rows[i]["c_str_010"].ToString();
                    }
                    #endregion

                    #region 手术明细流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_001"]))
                    {
                        cis_oper_detail.SSMXLSH = 0;
                    }
                    else
                    {
                        cis_oper_detail.SSMXLSH = Convert.ToInt32(dta.Rows[i]["c_int_001"]);
                    }
                    #endregion

                    #region 就诊流水号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_005"]))
                    {
                        cis_oper_detail.JZLSH = 0;
                    }
                    else
                    {
                        cis_oper_detail.JZLSH = Convert.ToInt32(dta.Rows[i]["c_int_005"]);
                    }
                    #endregion

                    #region 手术标识号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_008"]))
                    {
                        cis_oper_detail.SSBSH = 0;
                    }
                    else
                    {
                        cis_oper_detail.SSBSH = Convert.ToInt32(dta.Rows[i]["c_int_008"]);
                    }
                    #endregion

                    #region 手术操作编码
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_011"]))
                    {
                        cis_oper_detail.SSCZBM = "不明";
                    }
                    else
                    {
                        cis_oper_detail.SSCZBM = dta.Rows[i]["c_str_011"].ToString();
                    }
                    #endregion

                    #region 手术操作名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_012"]))
                    {
                        cis_oper_detail.SSCZMC = "不明";
                    }
                    else
                    {
                        cis_oper_detail.SSCZMC = dta.Rows[i]["c_str_012"].ToString();
                    }
                    #endregion

                    #region 手术前诊断
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_004"]))
                    {
                        cis_oper_detail.SSQZD = "不明";
                    }
                    else
                    {
                        cis_oper_detail.SSQZD = dta.Rows[i]["c_str_004"].ToString();
                    }
                    #endregion

                    #region 手术后诊断
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_005"]))
                    {
                        cis_oper_detail.SSHZD = "不明";
                    }
                    else
                    {
                        cis_oper_detail.SSHZD = dta.Rows[i]["c_str_005"].ToString();
                    }
                    #endregion

                    #region 手术医生工号
                    if(Convert.IsDBNull(dta.Rows[i]["c_int_002"]))
                    {
                        cis_oper_detail.SSYSGH = 0;
                    }
                    else
                    {
                        cis_oper_detail.SSYSGH = Convert.ToInt32(dta.Rows[i]["c_int_002"]);
                    }
                    #endregion

                    #region 手术医生姓名
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_006"]))
                    {
                        cis_oper_detail.SSYSXM = "不明";
                    }
                    else
                    {
                        cis_oper_detail.SSYSXM = dta.Rows[i]["c_str_006"].ToString();
                    }
                    #endregion

                    #region 麻醉方式名称
                    if(Convert.IsDBNull(dta.Rows[i]["c_str_015"]))
                    {
                        cis_oper_detail.MZFSMC = "不明";
                    }
                    else
                    {
                        cis_oper_detail.MZFSMC = dta.Rows[i]["c_str_015"].ToString();
                    }
                    #endregion

                    #region 切口/愈合等级编码
                    if (Convert.IsDBNull(dta.Rows[i]["c_str_000"]))
                    {
                        cis_oper_detail.QKYHDJBM = "不明";
                    }
                    else
                    {
                        switch (Convert.ToInt32(dta.Rows[i]["c_str_000"]))
                        {
                            case 1: cis_oper_detail.QKYHDJBM = "Ⅰ/甲"; break;
                            case 2: cis_oper_detail.QKYHDJBM = "Ⅰ/乙"; break;
                            case 3: cis_oper_detail.QKYHDJBM = "Ⅰ/丙"; break;
                            case 4: cis_oper_detail.QKYHDJBM = "Ⅱ/甲"; break;
                            case 5: cis_oper_detail.QKYHDJBM = "Ⅱ/乙"; break;
                            case 6: cis_oper_detail.QKYHDJBM = "Ⅱ/丙"; break;
                            case 7: cis_oper_detail.QKYHDJBM = "Ⅲ/甲"; break;
                            case 8: cis_oper_detail.QKYHDJBM = "Ⅲ/乙"; break;
                            case 9: cis_oper_detail.QKYHDJBM = "Ⅲ/丙"; break;
                            case 10: cis_oper_detail.QKYHDJBM = "Ⅳ/甲"; break;
                            case 11: cis_oper_detail.QKYHDJBM = "Ⅳ/乙"; break;
                            case 12: cis_oper_detail.QKYHDJBM = "Ⅳ/丙"; break;                           
                        }
                    }
                    
                    #endregion

                    #region 手术开始时间
                    if (Convert.IsDBNull(dta.Rows[i]["c_date_000"]))
                    {
                        cis_oper_detail.SSSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_oper_detail.SSSJ = Convert.ToDateTime(dta.Rows[i]["c_date_000"]);
                    }
                    #endregion
                    
                    #region 创建时间
                    if (Convert.IsDBNull(dta.Rows[i]["create_time"]))
                    {
                        cis_oper_detail.CJSJ = Convert.ToDateTime("1800-01-01 00:00:00");
                    }
                    else
                    {
                        cis_oper_detail.CJSJ = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }
                    #endregion

                    #region 其他
                    cis_oper_detail.XGBZ = 0;
                    cis_oper_detail.YLYL1 = null;
                    cis_oper_detail.YLYL2 = null;
                    #endregion



                    #endregion 

                    list.Add(cis_oper_detail);

                    //取出表中最大的时间
                    if (i == dta.Rows.Count - 1)
                    {
                        create_time = Convert.ToDateTime(dta.Rows[i]["create_time"]);
                    }

                }

                access.InsertList(list);
                list.Clear();
                dta.Clear();

                // MessageBox.Show("存入从" + create_time.ToString() + "到" + end_time.ToString() + "的数据,共" + step_time_num.ToString() + "条！");

                if (end_time > maxtime)
                {
                    MessageBox.Show("已经存入全部数据！");
                }
            }
        }















        /// <summary>
        /// 从MDT的DataTable将就诊记录表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void Medical_Record_Trans(string excel_sheetname, DopServiceHelp help)
        {
            MedicalRecordAccess access = new MedicalRecordAccess();
            List<Medical_Record> list = new List<Medical_Record>();
            Medical_Record record = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            int seqid = 0;

            for (int j = 0; j < 10; j++)    //存10次，每次存20条    
            {
                dta_MDT = trans.getMedicalRecordRecordWard(seqid, help, attribute);
                //将dta_MDT导入实体Bean中
                for (int i = 0; i < dta_MDT.Rows.Count; i++)
                {
                    record = new Medical_Record();

                    record.PatientID = dta_MDT.Rows[i]["病人标识号"].ToString();
                    record.JZLSH = dta_MDT.Rows[i]["就诊流水号"].ToString();
                    record.YLJGDM = dta_MDT.Rows[i]["医疗机构代码"].ToString();
                    record.KH = dta_MDT.Rows[i]["卡号"].ToString();
                    record.KLX = dta_MDT.Rows[i]["卡类型"].ToString();
                    record.HZSX = dta_MDT.Rows[i]["patient_attribute"].ToString();
                    record.JZLX = dta_MDT.Rows[i]["就诊类型"].ToString();
                    record.JZKSBM = dta_MDT.Rows[i]["就诊科室编码"].ToString();
                    record.JZKSMC = dta_MDT.Rows[i]["就诊科室名称"].ToString();
                    record.JZZDBM = dta_MDT.Rows[i]["门诊第一诊断编码"].ToString();
                    record.JZZDMC = dta_MDT.Rows[i]["门诊第一诊断名称"].ToString();
                    record.BMLX = dta_MDT.Rows[i]["编码类型"].ToString();
                    record.JZZT = dta_MDT.Rows[i]["就诊状态"].ToString();
                    record.JZRQ = dta_MDT.Rows[i]["就诊日期"].ToString();
                    record.JZKSRQ = dta_MDT.Rows[i]["就诊开始时间"].ToString();
                    record.JZJSRQ = dta_MDT.Rows[i]["诊治结束时间"].ToString();

                    //record.JZZDSM=就诊(入院)诊断说明"].ToString();   这个字段需要的话要到inpatient_record_MDT这个MDT中取用
                    //record.JZBZ=16位编码，第1位区别初诊和复诊。      需要跟坦瑞的人确定一下
                    //record.ZYJSSJ = DateTime.Parse(dta_MDT.Rows[i]["diagnosis_and_treatment_finish_time"].ToString());
                    record.XGBZ = null;
                    record.YLYL1 = null;
                    record.YLYL2 = null;
                    list.Add(record);

                    if (i == dta_MDT.Rows.Count - 1)
                    {
                        seqid = Convert.ToInt32(dta_MDT.Rows[i]["就诊流水号"]);
                    }
                }
            }
            access.InsertList(list);
        }

        /// <summary>
        /// 从MDT的DataTable将检验报告单存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void LIS_Report_Trans(string excel_sheetname,DopServiceHelp help)
        {
            LIS_ReportAccess access = new LIS_ReportAccess();
            List<LIS_Report> list = new List<LIS_Report>();
            LIS_Report report = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            int seqid = 0;
            for (int j = 0; j < 10; j++)    //存10次，每次存20条
            {  
               dta_MDT = trans.getLISReportRecordWard(seqid,help,attribute);

               //将dta_MDT导入实体Bean中
               for (int i = 0; i < dta_MDT.Rows.Count; i++)
               {
                  

                   list.Add(report);
                   if (i == dta_MDT.Rows.Count - 1)
                   {
                       seqid = Convert.ToInt32(dta_MDT.Rows[i]["检验报告单号"]);
                   }
               }
            }
            access.InsertList(list);
        }


        /// <summary>
        /// 从MDT的DataTable将门诊医嘱明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void Outpatient_DrAdvice_Detail_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Outpatient_DrAdvice_DetailAccess access = new Outpatient_DrAdvice_DetailAccess();
            List<Outpatient_DrAdvice_Detail> list = new List<Outpatient_DrAdvice_Detail>();
            Outpatient_DrAdvice_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            int seqid = 0;
            for (int j = 0; j < 32000; j++)    //存32000次，每次存20条
            {
                dta_MDT = trans.getOutpatientDrAdviceDetailRecordWard(seqid, help, attribute);

                //将dta_MDT导入实体Bean中
                if (dta_MDT != null)
                {
                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                        
                        list.Add(detail);
                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["医嘱序号"]);
                        }
                    }
                }
                else
                {
                    break;
                }
                //access.InsertList(list,bar);
                list.Clear();
                
            }
        }

        /// <summary>
        /// 从MDT的DataTable将住院医嘱明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void Inpatient_DrAdvice_Detail_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Inpatient_DrAdvice_DetailAccess access = new Inpatient_DrAdvice_DetailAccess();
            List<Inpatient_DrAdvice_Detail> list = new List<Inpatient_DrAdvice_Detail>();
            Inpatient_DrAdvice_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            int seqid = 0;
            for (int j = 0; j < 32000; j++)    //存32000次，每次存20条
            {
                dta_MDT = trans.getInpatientDrAdviceDetailRecordWard(seqid, help, attribute);

                //将dta_MDT导入实体Bean中
                if (dta_MDT != null)
                {
                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                      

                        list.Add(detail);
                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["医嘱序号"]);
                        }
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list,bar);
                list.Clear();
            }
        }

        /// <summary>
        /// 从MDT的DataTable将检验指标表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void LIS_Indicators_Trans(string excel_sheetname, DopServiceHelp help)
        {
            LIS_IndicatorsAccess access = new LIS_IndicatorsAccess();
            List<LIS_Indicators> list = new List<LIS_Indicators>();
            LIS_Indicators indicators = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 0;
            for (int j = 0; j < 10; j++)    //存10次，每次存20条
            {
                dta_MDT = trans.getLISIndicatorsRecordWard(seqid,help,attribute);

                for (int i = 0; i < dta_MDT.Rows.Count; i++)
                {
                    

                    list.Add(indicators);
                    if (i == dta_MDT.Rows.Count - 1)
                    {
                        seqid = Convert.ToInt32(dta_MDT.Rows[i]["标本号"]);
                    }
                }
            }
            access.InsertList(list);
        }

        /// <summary>
        /// 从MDT的DataTable将药敏结果存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void LIS_Allergy_Result_Trans(string excel_sheetname, DopServiceHelp help)
        {
            LIS_Allergy_ResultAccess access = new LIS_Allergy_ResultAccess();
            List<LIS_Allergy_Result> list = new List<LIS_Allergy_Result>();
            LIS_Allergy_Result result = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            int seqid = 0;
            for (int j = 0; j < 1000; j++)    //存1000次，每次存20条
            {
                dta_MDT = trans.getLISALLergyResultRecordWard(seqid, help, attribute);
                if (dta_MDT != null)
                {
                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                        result = new LIS_Allergy_Result();
                        result.YMJGLSH = dta_MDT.Rows[i]["药敏检测结果序列号"].ToString();
                        result.YLJGDM = dta_MDT.Rows[i]["医疗机构代码"].ToString();
                        result.BGDH = dta_MDT.Rows[i]["检验报告单号"].ToString();
                        result.BGRQ = dta_MDT.Rows[i]["报告日期"].ToString();
                        result.XJDH = dta_MDT.Rows[i]["细菌代号"].ToString();
                        result.YMDM = dta_MDT.Rows[i]["药敏检测代码"].ToString();
                        result.YMMC = dta_MDT.Rows[i]["药敏检测名称"].ToString();
                        result.JCJG = dta_MDT.Rows[i]["药敏检测结果"].ToString();
                        result.ZPHYL = dta_MDT.Rows[i]["纸片含药量"].ToString();
                        result.YJND = dta_MDT.Rows[i]["抑菌浓度"].ToString();
                        result.YJHZJ = dta_MDT.Rows[i]["抑菌环直径"].ToString();

                        result.XGBZ = null;
                        result.YLYL1 = null;

                        list.Add(result);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["药敏检测结果序列号"]);
                        }
                    }
                }

                else
                {
                    break;
                }
                access.InsertList(list);
            }
        }

        /// <summary>
        /// 从MDT的DataTable将细菌结果存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void LIS_Bacteria_Result_Trans(string excel_sheetname, DopServiceHelp help)
        {
            LIS_Bacteria_ResultAccess access = new LIS_Bacteria_ResultAccess();
            List<LIS_Bacteria_Result> list = new List<LIS_Bacteria_Result>();
            LIS_Bacteria_Result result = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            int seqid = 0;
            for (int j = 0; j < 10; j++)    //存10次，每次存20条
            {
                dta_MDT = trans.getLISBacteriaResultRecordWard(seqid,help,attribute);
                if (dta_MDT != null)
                {
                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                        result = new LIS_Bacteria_Result();

                        result.XJJGLSH = dta_MDT.Rows[i]["细菌检测结果序列号"].ToString();
                        result.YLJGDM = dta_MDT.Rows[i]["医疗机构代码"].ToString();
                        result.BGDH = dta_MDT.Rows[i]["检验报告单号"].ToString();
                        result.BGRQ = dta_MDT.Rows[i]["报告日期"].ToString();
                        result.XJDH = dta_MDT.Rows[i]["细菌代号"].ToString();
                        result.XJMC = dta_MDT.Rows[i]["细菌名称"].ToString();
                        result.JLJS = dta_MDT.Rows[i]["菌落计数"].ToString();
                        result.BYJ = dta_MDT.Rows[i]["培养基"].ToString();
                        result.BYSJ = dta_MDT.Rows[i]["培养时间"].ToString();
                        result.PYTJ = dta_MDT.Rows[i]["培养条件"].ToString();
                        result.FXFS = dta_MDT.Rows[i]["发现方式"].ToString();
                        result.JCJG = dta_MDT.Rows[i]["细菌检测结果"].ToString();
                        result.JCJGWZ = dta_MDT.Rows[i]["细菌检测结果描述"].ToString();

                        result.XGBZ = null;
                        result.YLYL1 = null;

                        list.Add(result);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["细菌检测结果序列号"]);
                        }
                    }
                }
                else 
                {
                    break;
                }
            }
            access.InsertList(list);
        }

        /// <summary>
        /// 从MDT的DataTable将住院病历手术明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void CIS_Operation_Detail_Trans(string excel_sheetname, DopServiceHelp help)
        {
            CIS_Operation_DetailAccess access = new CIS_Operation_DetailAccess();
            List<CIS_Operation_Detail> list = new List<CIS_Operation_Detail>();
            CIS_Operation_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 0;
            for (int j = 0; j < 32000; j++)    //存32000次，每次存20条
            {
                dta_MDT = trans.getCISOperationDetailRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getCISOperationDetailRecordWard(seqid,help,attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                       
                        list.Add(detail);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["operation_item_seq"]);
                        }
                    }
                }
                else
                {
                    break;
                }

                access.InsertList(list);
                list.Clear();
            }
        }

        /// <summary>
        /// 从MDT的DataTable将住院收费结算表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void Inpatient_Fee_Settle_Trans(string excel_sheetname, DopServiceHelp help)
        {

            Inpatient_Fee_SettleAccess access = new Inpatient_Fee_SettleAccess();
            List<Inpatient_Fee_Settle> list = new List<Inpatient_Fee_Settle>();
            Inpatient_Fee_Settle settle = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 121926;
            for (int j = 0; j < 1000; j++)    //存1000次，每次存20条
            {
                dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                        

                        list.Add(settle);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["原始系统编码"]);
                        }
                        //}
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list);
            }
        }

        /// <summary>
        /// 从MDT的DataTable将门诊收费结算表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void Outpatient_Fee_Settle_Trans(string excel_sheetname, DopServiceHelp help)
        {

            Outpatient_Fee_SettleAccess access = new Outpatient_Fee_SettleAccess();
            List<Outpatient_Fee_Settle> list = new List<Outpatient_Fee_Settle>();
            Outpatient_Fee_Settle settle = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            //int seqid = 0;
            int seqid = 57651094;
            for (int j = 0; j < 1000; j++)    //存1000次，每次存20条
            {
                dta_MDT = trans.getOutpatientFeeSettleRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                      

                        list.Add(settle);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["原始系统编码"]);
                        }
                        //}
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list);
            }
        }

        /// <summary>
        /// 从MDT的DataTable将住院收费明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        /// <param name="help"></param>
        public void Inpatient_Fee_Detail_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Inpatient_Fee_DetailAccess access = new Inpatient_Fee_DetailAccess();
            List<Inpatient_Fee_Detail> list = new List<Inpatient_Fee_Detail>();
            Inpatient_Fee_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 0;
            for (int j = 0; j < 1000; j++)    //存1000次，每次存20条
            {
                dta_MDT = trans.getInpatientFeeDetailRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                     
                        detail.YLYL1 = null;

                        list.Add(detail);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["原始系统编码"]);
                        }
                        //}
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list);
                list.Clear();
            }
        }

        /// <summary>
        /// 从MDT的DataTable将门诊收费明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        /// <param name="help"></param>
        public void Outpatient_Fee_Detail_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Outpatient_Fee_DetailAccess access = new Outpatient_Fee_DetailAccess();
            List<Outpatient_Fee_Detail> list = new List<Outpatient_Fee_Detail>();
            Outpatient_Fee_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 0;
            for (int j = 0; j < 32000; j++)    //存32000次，每次存20条
            {
                dta_MDT = trans.getOutpatientFeeDetailRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                       
                        detail.YLYL1 = null;

                        list.Add(detail);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["结算收据号"]);
                        }
                        //}
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list);
                list.Clear();
            }
        }

        /// <summary>
        /// 从MDT的DataTable将结算费别表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        /// <param name="help"></param>
        public void Settle_Fee_Type_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Settle_Fee_TypeAccess access = new Settle_Fee_TypeAccess();
            List<Settle_Fee_Type> list = new List<Settle_Fee_Type>();
            Settle_Fee_Type type = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 0;
            for (int j = 0; j < 32000; j++)    //存32000次，每次存20条
            {
                dta_MDT = trans.getSettleFeeTypeRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                        type = new Settle_Fee_Type();

                        //type.JSFBID = dta_MDT.Rows[i]["原始系统编码"].ToString();
                        //type.JSSJH = dta_MDT.Rows[i]["结算收据号"].ToString();
                        //type.PatientID = dta_MDT.Rows[i]["病人标识号"].ToString();
                        //type.JZLSH = dta_MDT.Rows[i]["就诊流水号"].ToString();
                        //type.MXFYLBBM = dta_MDT.Rows[i]["费用类别编码"].ToString();
                        //type.MXFYLBMC = dta_MDT.Rows[i]["费用类别名称"].ToString();
                        //type.ZJE = dta_MDT.Rows[i]["总金额"].ToString();
                        //type.YBFDBF = dta_MDT.Rows[i]["医保负担金额"].ToString();
                        //type.YBZFBF = dta_MDT.Rows[i]["医保自负金额"].ToString();
                        //type.ZFJE = dta_MDT.Rows[i]["自费金额"].ToString();



                        type.YLYL1 = null;

                        list.Add(type);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["结算收据号"]);
                        }
                    }
                }
                else
                {
                    break;
                }

                access.InsertList(list);
                list.Clear();
            }
        }

        /// <summary>
        /// 从MDT的DataTable将门诊记录表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        /// <param name="help"></param>
        public void Outpatient_Record_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Outpatient_RecordAccess access = new Outpatient_RecordAccess();
            List<Outpatient_Record> list = new List<Outpatient_Record>();
            Outpatient_Record record = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            //int seqid = 0;
            int seqid = 280258;
            for (int j = 0; j < 1000; j++)    //存1000次，每次存20条
            {
                dta_MDT = trans.getOutpatientRecordRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                       

                        list.Add(record);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["就诊流水号"]);
                        }
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list,bar);
            }
        }

        /// <summary>
        /// 从MDT的DataTable将住院记录表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        /// <param name="help"></param>
        public void Inpatient_Record_Trans(string excel_sheetname, DopServiceHelp help)
        {
            Inpatient_RecordAccess access = new Inpatient_RecordAccess();
            List<Inpatient_Record> list = new List<Inpatient_Record>();
            Inpatient_Record record = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            int seqid = 36385;
            for (int j = 0; j < 1000; j++)    //存10次，每次存20条
            {
                dta_MDT = trans.getInpatientRecordRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getInpatientFeeSettleRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                        

                        list.Add(record);

                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["就诊流水号"]);
                        }
                        //}
                    }
                }
                else
                {
                    break;
                }
                access.InsertList(list,bar);
            }
        }

        //public void Fee_Record_Trans(string excel_sheetname)
        //{
        //    Fee_RecordAccess access = new Fee_RecordAccess();
        //    List<Fee_Record> list = new List<Fee_Record>();
        //    Fee_Record record = null;

        //    //用字符串数组attribute存放excel中的MDT的属性 
        //    GetMDT trans = new GetMDT();
        //    string[] attribute = trans.ReadFromExcel(excel_sheetname);

        //    //获取attribute属性的MDT转化成的表
        //    DataTable dta_MDT = new DataTable();
        //    dta_MDT = trans.GetdataWS("inpatient_patient_settle_MDT", attribute);

        //    for (int i = 0; i < dta_MDT.Rows.Count; i++)
        //    {
        //        record = new Fee_Record();

        //        record.SFJLID = dta_MDT.Rows[i]["original_system_code"].ToString();
        //        record.JZLSH = dta_MDT.Rows[i]["encounter_serial_number"].ToString();
        //        record.KLX = dta_MDT.Rows[i]["card_number"].ToString();
        //        record.KH = dta_MDT.Rows[i]["card_type"].ToString();
        //        record.YLJGDM = dta_MDT.Rows[i]["medical_institution_code"].ToString();
        //        record.ZFY = Convert.ToDouble(dta_MDT.Rows[i]["total_money_amount"].ToString());
        //        record.YBFWZE = Convert.ToDouble(dta_MDT.Rows[i]["public_insurance_eligible_total"].ToString());
        //        record.YBFWZF = Convert.ToDouble(dta_MDT.Rows[i]["public_insurance_pay_total"].ToString());
        //        record.YBZFBF = Convert.ToDouble(dta_MDT.Rows[i]["insurance_self_pay_amount"].ToString());
        //        record.YBFLZF = Convert.ToDouble(dta_MDT.Rows[i]["public_insurance_copay_item"].ToString());
        //        record.GRZF = Convert.ToDouble(dta_MDT.Rows[i]["public_insurance_not_covered"].ToString());
                
        //        //具体费用需要在结算收据里查找？？？
        //        //record.ZYF=dta_MDT.Rows[i][""].ToString();
        //        //record.ZLF=dta_MDT.Rows[i][""].ToString();
        //        //record.ZHF=dta_MDT.Rows[i][""].ToString();
        //        //record.HLF=dta_MDT.Rows[i][""].ToString();
        //        //record.SHCF=dta_MDT.Rows[i][""].ToString();
        //        //record.JCF=dta_MDT.Rows[i][""].ToString();
        //        //record.HYF=dta_MDT.Rows[i][""].ToString();
        //        //record.CPF=dta_MDT.Rows[i][""].ToString();
        //        //record.TSF=dta_MDT.Rows[i][""].ToString();
        //        //record.SXF=dta_MDT.Rows[i][""].ToString();
        //        //record.SYF=dta_MDT.Rows[i][""].ToString();
        //        //record.XYF=dta_MDT.Rows[i][""].ToString();
        //        //record.ZCYF=dta_MDT.Rows[i][""].ToString();
        //        //record.ZCAF=dta_MDT.Rows[i][""].ToString();
        //        //record.QT=dta_MDT.Rows[i][""].ToString();


        //      //  record.JSBZ  结算标志16 位编码。第 1 位用于标记是否为在院结算。0：出院结算、1：在院结算。其余位预留。
        //        record.JSSJ =  DateTime.Parse(dta_MDT.Rows[i]["settle_time"].ToString());
        //        record.YLYL1 = null;
        //        record.STFBZ = dta_MDT.Rows[i]["undo buffer"].ToString();//注意！！撤销标志不是直接从MDT里取的！！

        //        list.Add(record);
        //    }
        //}

        
        /// <summary>
        /// 从MDT的DataTable将收费明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void Fee_Detail_Trans(string excel_sheetname)
        {
            Fee_DetailAccess access = new Fee_DetailAccess();
            List<Fee_Detail> list = new List<Fee_Detail>();
            Fee_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            dta_MDT = trans.GetdataWS("patient_fee_record_MDT", attribute);

            for (int i = 0; i < dta_MDT.Rows.Count; i++)
            {
                detail = new Fee_Detail();

                detail.SFMXID = dta_MDT.Rows[i]["settle_receipt_serial_number"].ToString();
                detail.XGBZ = dta_MDT.Rows[i]["is_charge_or_refund"].ToString();
                detail.KLX = dta_MDT.Rows[i]["card_type"].ToString();
                detail.KH = dta_MDT.Rows[i]["card_number"].ToString();
                detail.YLJGDM = dta_MDT.Rows[i]["medical_institution_code"].ToString();
                detail.MXFYLB = dta_MDT.Rows[i]["fee_type_code"].ToString();
                detail.MXXMBM = dta_MDT.Rows[i]["item_code"].ToString();
                detail.MXXMMC = dta_MDT.Rows[i]["item_name"].ToString();
                detail.MXXMDW = dta_MDT.Rows[i]["item_unit"].ToString();
                detail.MXXMDJ = Convert.ToDouble(dta_MDT.Rows[i]["retail_price"]);
                detail.MXXMSL = Convert.ToDouble(dta_MDT.Rows[i]["amount"]);
                detail.MXXMJE = Convert.ToDouble(dta_MDT.Rows[i]["total_money_amount"]);
                detail.MXXMZFW = Convert.ToDouble(dta_MDT.Rows[i]["public_insurance_not_covered_item"]);
                detail.MXXMZFN = Convert.ToDouble(dta_MDT.Rows[i]["public_insurance_copay_detail_item"]);
                detail.YLYL1 = null;
                detail.YZID = null;

                list.Add(detail);
            }
        }
        
       

        /// <summary>
        /// 从MDT的DataTable将住院病历主表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void CIS_Main_Trans(string excel_sheetname, DopServiceHelp help)
        {
            CIS_MainAccess access = new CIS_MainAccess();
            List<CIS_Main> list = new List<CIS_Main>();
            CIS_Main main = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);
            int seqid = 00213651;
            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();

            for (int j = 0; j < 32000; j++)    //存32000次，每次存20条
            {
                dta_MDT = trans.getCISMainRecordWard(seqid, help, attribute);

                if (dta_MDT != null)
                {
                    //dta_MDT = trans.getCISMainRecordWard(seqid, help, attribute);

                    for (int i = 0; i < dta_MDT.Rows.Count; i++)
                    {
                      

                        list.Add(main);
                        if (i == dta_MDT.Rows.Count - 1)
                        {
                            seqid = Convert.ToInt32(dta_MDT.Rows[i]["住院号"]);
                        }
                    }
                }
                else
                {
                    break;
                }

                access.InsertList(list);
                list.Clear();
            }
            
        }


        /// <summary>
        /// 从MDT的DataTable将住院诊断明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void CIS_IH_Diagnosis_Detail_Trans(string excel_sheetname)
        {
            CIS_IH_Diagnosis_DetailAccess access = new CIS_IH_Diagnosis_DetailAccess();
            List<CIS_IH_Diagnosis_Detail> list = new List<CIS_IH_Diagnosis_Detail>();
            CIS_IH_Diagnosis_Detail detail = null;
           
           //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            dta_MDT = trans.GetdataWS("drug_susceptibility_test_result_MDT", attribute);

            for (int i = 0; i < dta_MDT.Rows.Count; i++)
            {
                detail = new CIS_IH_Diagnosis_Detail();
              


                list.Add(detail);
            }
        }


        /// <summary>
        /// 从MDT的DataTable将出院诊断明细表存入数据库
        /// </summary>
        /// <param name="excel_sheetname"></param>
        public void CIS_LH_Diagnosis_Detail_Trans(string excel_sheetname)
        {
            CIS_LH_Diagnosis_DetailAccess access = new CIS_LH_Diagnosis_DetailAccess();
            List<CIS_LH_Diagnosis_Detail> list = new List<CIS_LH_Diagnosis_Detail>();
            CIS_LH_Diagnosis_Detail detail = null;

            //用字符串数组attribute存放excel中的MDT的属性 
            GetMDT trans = new GetMDT();
            string[] attribute = trans.ReadFromExcel(excel_sheetname);

            //获取attribute属性的MDT转化成的表
            DataTable dta_MDT = new DataTable();
            dta_MDT = trans.GetdataWS("drug_susceptibility_test_result_MDT", attribute);

            for (int i = 0; i < dta_MDT.Rows.Count; i++)
            {
                detail = new CIS_LH_Diagnosis_Detail();
               


                list.Add(detail);
            }
        }
    }

    
}
